Tutorial by Examples

Commits can be squashed during a git rebase. It is recommended that you understand rebasing before attempting to squash commits in this fashion. Determine which commit you would like to rebase from, and note its commit hash. Run git rebase -i [commit hash]. Alternatively, you can type HE...
<?php echo esc_url( get_bloginfo( 'stylesheet_directory' ) ); ?> Output http://example.com/wp-content/themes/twentysixteen Alternatives Internally, get_bloginfo( 'stylesheet_directory' ) calls get_stylesheet_directory_uri(), so you may want to use that instead: <?php echo esc_url( ...
This program, saved to a file named HelloWorld.dpr, compiles to a console application that prints "Hello World" to the console: program HelloWorld; {$APPTYPE CONSOLE} begin WriteLn('Hello World'); end.
C++14 Lambdas can capture expressions, rather than just variables. This permits lambdas to store move-only types: auto p = std::make_unique<T>(...); auto lamb = [p = std::move(p)]() //Overrides capture-by-value of `p`. { p->SomeFunc(); }; This moves the outer p variable into th...
If you precede a local variable's name with an &, then the variable will be captured by reference. Conceptually, this means that the lambda's closure type will have a reference variable, initialized as a reference to the corresponding variable from outside of the lambda's scope. Any use of the v...
By default, local variables that are not explicitly specified in the capture list, cannot be accessed from within the lambda body. However, it is possible to implicitly capture variables named by the lambda body: int a = 1; int b = 2; // Default capture by value [=]() { return a + b; }; // OK;...
A controller is a basic structure used in Angular to preserve scope and handle certain actions within a page. Each controller is coupled with an HTML view. Below is a basic boilerplate for an Angular app: <!DOCTYPE html> <html lang="en" ng-app='MyFirstApp'> <head...
To repeat a function indefinitely, setTimeout can be called recursively: function repeatingFunc() { console.log("It's been 5 seconds. Execute the function again."); setTimeout(repeatingFunc, 5000); } setTimeout(repeatingFunc, 5000); Unlike setInterval, this ensures that t...
Dim input as String = Console.ReadLine() Console.ReadLine() will read the console input from the user, up until the next newline is detected (usually upon pressing the Enter or Return key). Code execution is paused in the current thread until a newline is provided. Afterwards, the next line of co...
Dim x As Int32 = 128 Console.WriteLine(x) ' Variable ' Console.WriteLine(3) ' Integer ' Console.WriteLine(3.14159) ' Floating-point number ' Console.WriteLine("Hello, world") ' String ' Console.WriteLine(myObject) ' Outputs the value from calling myObject.ToString() The Console.Wri...
Dim x As Int32 = 128 Console.Write(x) ' Variable ' Console.Write(3) ' Integer ' Console.Write(3.14159) ' Floating-point number ' Console.Write("Hello, world") ' String ' The Console.Write() method is identical to the Console.WriteLine() method except that it prints the given argumen...
Libraries other than jQuery may also use $ as an alias. This can cause interference between those libraries and jQuery. To release $ for use with other libraries: jQuery.noConflict(); After calling this function, $ is no longer an alias for jQuery. However, you can still use the variable jQuery...
Create a snapshot of a whole database: mysqldump [options] db_name > filename.sql Create a snapshot of multiple databases: mysqldump [options] --databases db_name1 db_name2 ... > filename.sql mysqldump [options] --all-databases > filename.sql Create a snapshot of one or more tables...
> mysqldump -u username -p [other options] Enter password: If you need to specify the password on the command line (e.g. in a script), you can add it after the -p option without a space: > mysqldump -u username -ppassword [other options] If you password contains spaces or special chara...
mysql [options] db_name < filename.sql Note that: db_name needs to be an existing database; your authenticated user has sufficient privileges to execute all the commands inside your filename.sql; The file extension .sql is fully a matter of style. Any extension would work. You cannot spe...
c++14 Lambda functions can take arguments of arbitrary types. This allows a lambda to be more generic: auto twice = [](auto x){ return x+x; }; int i = twice(2); // i == 4 std::string s = twice("hello"); // s == "hellohello" This is implemented in C++ by making the closur...
If a lambda's capture list is empty, then the lambda has an implicit conversion to a function pointer that takes the same arguments and returns the same return type: auto sorter = [](int lhs, int rhs) -> bool {return lhs < rhs;}; using func_ptr = bool(*)(int, int); func_ptr sorter_func = ...
performance.now() returns a precise timestamp: The number of milliseconds, including microseconds, since the current web page started to load. More generally, it returns the time elapsed since the performanceTiming.navigationStart event. t = performance.now(); For example, in a web browser's ma...
Date.now() returns the number of whole milliseconds that have elapsed since 1 January 1970 00:00:00 UTC. t = Date.now(); For example, Date.now() returns 1461069314 if it was called on 19 April 2016 at 12:35:14 GMT.
In older browsers where Date.now() is unavailable, use (new Date()).getTime() instead: t = (new Date()).getTime(); Or, to provide a Date.now() function for use in older browsers, use this polyfill: if (!Date.now) { Date.now = function now() { return new Date().getTime(); }; }

Page 72 of 1336