Tutorial by Examples: n

git log --pretty=format:"%Cgreen%ci %Cblue%cn %Cgreen%cr%Creset %s" This will give a nice overview of all commits (1 per line) with date, user and commit message. The --pretty option has many placeholders, each starting with %. All options can be found here
It is not possible to add and commit an empty folder in Git due to the fact that Git manages files and attaches their directory to them, which slims down commits and improves speed. To get around this, there are two methods: Method one: .gitkeep One hack to get around this is to use a .gitkeep fil...
Arrow functions are lexically scoped; this means that their this Binding is bound to the context of the surrounding scope. That is to say, whatever this refers to can be preserved by using an arrow function. Take a look at the following example. The class Cow has a method that allows for it to pr...
Arrow functions do not expose an arguments object; therefore, arguments would simply refer to a variable in the current scope. const arguments = [true]; const foo = x => console.log(arguments[0]); foo(false); // -> true Due to this, arrow functions are also not aware of their caller/ca...
Arrow functions may implicitly return values by simply omitting the curly braces that traditionally wrap a function's body if their body only contains a single expression. const foo = x => x + 1; foo(1); // -> 2 When using implicit returns, object literals must be wrapped in parenthesis s...
Arrow functions can behave very similar to classic functions in that you may explicitly return a value from them using the return keyword; simply wrap your function's body in curly braces, and return a value: const foo = x => { return x + 1; } foo(1); // -> 2
xcrun uses the system default Xcode version (set via xcode-select) to locate and execute command line tools from the Xcode application bundle, e.g., llvm-cov. # Generate code coverage reports via llvm-cov # /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin xc...
C extensions are comprised of two general pieces: The C Code itself. The extension configuration file. To get started with your first extension put the following in a file named extconf.rb: require 'mkmf' create_makefile('hello_c') A couple of things to point out: First, the name hell...
Use Spliterators.spliterator() or Spliterators.spliteratorUnknownSize() to convert an iterator to a stream: Iterator<String> iterator = Arrays.asList("A", "B", "C").iterator(); Spliterator<String> spliterator = Spliterators.spliteratorUnknownSize(itera...
In this example we have only one object but it is shared between/executed on different threads. Ordinary usage of fields to save state would not be possible because the other thread would see that too (or probably not see). public class Test { public static void main(String[] args) { ...
Reduction is the process of applying a binary operator to every element of a stream to result in one value. The sum() method of an IntStream is an example of a reduction; it applies addition to every term of the Stream, resulting in one final value: This is equivalent to (((1+2)+3)+4) The reduc...
To initialize a static final fields that require using more than a single expression, a static initializer can be used to assign the value. The following example initializes a unmodifiable set of Strings: public class MyClass { public static final Set<String> WORDS; static {...
Sun / Oracle releases of Java SE come in two forms: JRE and JDK. In simple terms, JREs support running Java applications, and JDKs also support Java development. Java Runtime Environment Java Runtime Environment or JRE distributions consist of the set of libraries and tools needed to run and mana...
Orthogonal to the JRE versus JDK dichotomy, there are two types of Java release that are widely available: The Oracle Hotspot releases are the ones that you download from the Oracle download sites. The OpenJDK releases are the ones that are built (typically by third-party providers) from the Ope...
A JDK installation and a text editor are the bare minimum for Java development. (It is nice to have a text editor that can do Java syntax highlighting, but you can do without.) However for serious development work it is recommended that you also use the following: A Java IDE such as Eclipse, In...
It is possible to create a set of variables that can act similar to an array (although they are not an actual array object) by using spaces in the SET statement: @echo off SET var=A "foo bar" 123 for %%a in (%var%) do ( echo %%a ) echo Get the variable directly: %var% Result: ...
You can enhance your own classes with generics just like NSArray or NSDictionary. @interface MyClass<__covariant T> @property (nonnull, nonatomic, strong, readonly) NSArray<T>* allObjects; - (void) addObject:(nonnull T)obj; @end
The format statement applies the given format to the specified variable for display purposes only, i.e. the underlying value does not change. data example1 ; Date = '02AUG2016'd ; /* stored as a SAS date, i.e. a number */ Date2 = '31AUG2016'd ; format Date monyy7. Date2 yymmddn8. ; run...
In order to be able to work with C structs as Ruby objects, you need to wrap them with calls to Data_Wrap_Struct and Data_Get_Struct. Data_Wrap_Struct wraps a C data structure in a Ruby object. It takes a pointer to your data structure, along with a few pointers to callback functions, and returns a...
//Here self.webView is the view whose screenshot I need to take //The screenshot is saved in jpg format in the application directory to avoid any loss of quality in retina display devices i.e. all current devices running iOS 10 UIGraphicsBeginImageContextWithOptions(self.webView.bounds.size, N...

Page 559 of 1088