Tutorial by Examples: er

In case you have accidentally commited a delete on a file and later realized that you need it back. First find the commit id of the commit that deleted your file. git log --diff-filter=D --summary Will give you a sorted summary of commits which deleted files. Then proceed to restore the file b...
To restore a file to a previous version you can use reset. git reset <sha1-of-commit> <file-name> If you have already made local changes to the file (that you do not require!) you can also use the --hard option
To recover a deleted branch you need to find the commit which was the head of your deleted branch by running git reflog You can then recreate the branch by running git checkout -b <branch-name> <sha1-of-commit> You will not be able to recover deleted branches if git's garbage col...
A newline can be included in a single-string or double-quoted string. Note that backslash-newline does not result in a newline, the line break is ignored. newline1=' ' newline2=" " newline3=$'\n' empty=\ echo "Line${newline1}break" echo "Line${newline2}break" ...
All the examples in this paragraph print the line !"#$&'()*;<=>? @[\]^`{|}~ A backslash quotes the next character, i.e. the next character is interpreted literally. The one exception is a newline: backslash-newline expands to the empty string. echo \!\"\#\$\&\'\(\)\*\;\...
The above type handler can be installed into SqlMapper using the AddTypeHandler method. SqlMapper.AddTypeHandler<IHtmlString>(new IHtmlStringTypeHandler()); Type inference allows you to omit the generic type parameter: SqlMapper.AddTypeHandler(new IHtmlStringTypeHandler()); There's als...
The >> operator will perform a bitwise "right shift," where the left operand's value is moved right by the number of bits given by the right operand. # 8 = 0b1000 8 >> 2 # Out: 2 # 2 = 0b10 bin(8 >> 2) # Out: 0b10 Performing a right bit shift of 1 is equivalent...
Numerical comparisons use the -eq operators and friends if [[ $num1 -eq $num2 ]]; then echo "$num1 == $num2" fi if [[ $num1 -le $num2 ]]; then echo "$num1 <= $num2" fi There are six numeric operators: -eq equal -ne not equal -le less or equal -lt less than ...
The zero value of a map is nil and has a length of 0. var m map[string]string fmt.Println(m == nil) // true fmt.Println(len(m) ==0) // true A nil map has no keys nor can keys be added. A nil map behaves like an empty map if read from but causes a runtime panic if written to. var m map[string]...
import fmt people := map[string]int{ "john": 30, "jane": 29, "mark": 11, } for key, value := range people { fmt.Println("Name:", key, "Age:", value) } Note that when iterating over a map with a range loop, the iteration order i...
people := map[string]int{ "john": 30, "jane": 29, "mark": 11, } for key, _ := range people { fmt.Println("Name:", key) } If you are just looking for the keys, since they are the first value, you can simply drop the underscore: for key := r...
To create a first-level (<h1>) header, use the equal sign (=) in a line under your text: All About Dogs ============== All About Dogs Use hyphens (-) for second-level (<h2>) headers: The Debut Novel --------------- The Debut Novel The line below the header can be of a...
The prefix ! operator returns the logical negation of its argument. That is, !true returns false, and !false returns true. print(!true) // prints "false" print(!false) // prints "true" func test(_ someBoolean: Bool) { if !someBoolean { print("someBoolean ...
NSArray *myColors = [NSArray arrayWithObjects: @"Red", @"Green", @"Blue", @"Yellow", nil]; NSLog (@"Number of elements in array = %lu", [myColors count]);
NSMutableArray *myColors; int i; int count; myColors = [NSMutableArray arrayWithObjects: @"Red", @"Green", @"Blue", @"Yellow", nil]; [myColors insertObject: @"Indigo" atIndex: 1]; [myColors insertObject: @"Violet" atIndex: 3];
You can "overwrite" a parent element's language declaration by introducing any element apart from applet, base, basefont, br, frame, frameset, hr, iframe, meta, param, script (of HTML 4.0) with an own lang attribute: <p lang="en" title="An English paragraph"> ...
The construct (?R) is equivalent to (?0) (or \g<0>) - it lets you recurse the whole pattern: <(?>[^<>]+|(?R))+> This will match properly balanced angle brackets with any text in-between the brackets, like <a<b>c<d>e>.
You can recurse into a subpattern using the following constructs (depending on the flavor), assuming n is a capturing group number, and name the name of a capturing group. (?n) \g<n> \g'0' (?&name) \g<name> \g'name' (?P>name) The following pattern: \[(?<angle>&...
The (?(DEFINE)...) construct lets you define subpatterns you may reference later through recursion. When encountered in the pattern it will not be matched against. This group should contain named subpattern definitions, which will be accessible only through recursion. You can define grammars this w...
Subpatterns can be referenced with their relative group number: (?-1) will recurse into the previous group (?+1) will recurse into the next group Also usable with the \g<N> syntax.

Page 33 of 417