Tutorial by Examples: l

If someone else wrote the code you are committing, you can give them credit with the --author option: git commit -m "msg" --author "John Smith <[email protected]>" You can also provide a pattern, which Git will use to search for previous authors: git commit -m &quo...
Python makes it very simple to check whether an item is in a list. Simply use the in operator. lst = ['test', 'twest', 'tweast', 'treast'] 'test' in lst # Out: True 'toast' in lst # Out: False Note: the in operator on sets is asymptotically faster than on lists. If you need to use it ...
To temporarily mark a file as ignored (pass file as parameter to alias) - type: unwatch = update-index --assume-unchanged To start tracking file again - type: watch = update-index --no-assume-unchanged To list all files that has been temporarily ignored - type: unwatched = "!git ls-fil...
Standard installation All Node.js binaries, installers, and source files can be downloaded here. You can download just the node.exe runtime or use the Windows installer (.msi), which will also install npm, the recommended package manager for Node.js, and configure paths. Installation by package m...
Users of homebrew can install gradle by running brew install gradle
Users of SdkMan can install Gradle by running: sdk install gradle Install specific version sdk list gradle sdk install gradle 2.14 Switch versions sdk use gradle 2.12
We plot a simple scatter plot using the builtin iris data set as follows: library(ggplot2) ggplot(iris, aes(x = Petal.Width, y = Petal.Length, color = Species)) + geom_point() This gives:
There are different cases where you must Explicitly specify the type parameters for a generic method. In both of the below cases, the compiler is not able to infer all of the type parameters from the specified method parameters. One case is when there are no parameters: public void SomeMethod<T...
Sometimes, you need to work with an array while ensuring you don't modify the original. Instead of a clone method, arrays have a slice method that lets you perform a shallow copy of any part of an array. Keep in mind that this only clones the first level. This works well with primitive types, like n...
The job of the linker is to link together a bunch of object files (.o files) into a binary executable. The process of linking mainly involves resolving symbolic addresses to numerical addresses. The result of the link process is normally an executable program. During the link process, the linker wi...
Compiling C programs requires you to work with five kinds of files: Source files: These files contain function definitions, and have names which end in .c by convention. Note: .cc and .cpp are C++ files; not C files. e.g., foo.c Header files: These files contain function prototypes and va...
After the C pre-processor has included all the header files and expanded all macros, the compiler can compile the program. It does this by turning the C source code into an object code file, which is a file ending in .o which contains the binary version of the source code. Object code is not directl...
The most common and easiest type of centering is that of lines of text in an element. CSS has the rule text-align: center for this purpose: HTML <p>Lorem ipsum</p> CSS p { text-align: center; } This does not work for centering entire block elements. text-align controls onl...
Sometimes it's necessary to convert a Discriminated Union to and from a string: module UnionConversion open Microsoft.FSharp.Reflection let toString (x: 'a) = match FSharpValue.GetUnionFields(x, typeof<'a>) with | case, _ -> case.Name let fromStri...
HTML <input type="range"></input> CSS EffectPseudo SelectorThumbinput[type=range]::-webkit-slider-thumb, input[type=range]::-moz-range-thumb, input[type=range]::-ms-thumbTrackinput[type=range]::-webkit-slider-runnable-track, input[type=range]::-moz-range-track, input[type=...
Given the text: foo: bar I would like to replace anything following "foo: " with "baz", but I want to keep "foo: ". This could be done with a capturing group like this: s/(foo: ).*/$1baz/ Which results in the text: foo: baz Example 1 or we could use \K,...
Date and LocalDate objects cannot be exactly converted between each other since a Date object represents both a specific day and time, while a LocalDate object does not contain time or timezone information. However, it can be useful to convert between the two if you only care about the actual date i...
Header file UIColor+XYZPalette.h: @interface UIColor (XYZPalette) +(UIColor *)xyz_indigoColor; @end and implementation UIColor+XYZPalette.m: @implementation UIColor (XYZPalette) +(UIColor *)xyz_indigoColor { return [UIColor colorWithRed:75/255.0f green:0/255.0f blue:130/255.0f al...
1. Install Node.js and NPM: Gulp requires Node.js and NPM, Node's package manager. Most installers include NPM with Node.js. Refer to the installation documentation or confirm it is already installed by running the following command in your terminal, npm -v // will return NPM version or error say...
The order of keys in Python dictionaries is arbitrary: they are not governed by the order in which you add them. For example: >>> d = {'foo': 5, 'bar': 6} >>> print(d) {'foo': 5, 'bar': 6} >>> d['baz'] = 7 >>> print(a) {'baz': 7, 'foo': 5, 'bar': 6} >&g...

Page 105 of 861