Tutorial by Examples: ear

These are all equivalent, the code inside the blocks will run when the document is ready: $(function() { // code }); $().ready(function() { // code }); $(document).ready(function() { // code }); Because these are equivalent the first is the recommended form, the following is a ...
Output buffering allows you to store any textual content (Text, HTML) in a variable and send to the browser as one piece at the end of your script. By default, php sends your content as it interprets it. <?php // Turn on output buffering ob_start(); // Print some output to the buffer (via...
To find files/directories with a specific name, relative to pwd: $ find . -name "myFile.txt" ./myFile.txt To find files/directories with a specific extension, use a wildcard: $ find . -name "*.txt" ./myFile.txt ./myFile2.txt To find files/directories matching one of ma...
void Main() { unsafe { int[] a = {1, 2, 3}; fixed(int* b = a) { Console.WriteLine(b[4]); } } } Running this code creates an array of length 3, but then tries to get the 5th item (index 4). On my machine, this printed 1910457872, bu...
pattern = r"(your base)" sentence = "All your base are belong to us." match = re.search(pattern, sentence) match.group(1) # Out: 'your base' match = re.search(r"(belong.*)", sentence) match.group(1) # Out: 'belong to us.' Searching is done anywhere in the ...
git log -S"#define SAMPLES" Searches for addition or removal of specific string or the string matching provided REGEXP. In this case we're looking for addition/removal of the string #define SAMPLES. For example: +#define SAMPLES 100000 or -#define SAMPLES 100000 git log -G&q...
There are several ways to search a key in std::map or in std::multimap. To get the iterator of the first occurrence of a key, the find() function can be used. It returns end() if the key does not exist. std::multimap< int , int > mmp{ {1, 2}, {3, 4}, {6, 5}, {8, 9}, {3, 4}, {6, 7} }; ...
// Java: IntStream.range(1, 4).forEach(System.out::println); // Kotlin: (inclusive range) (1..3).forEach(::println)
git bisect allows you to find which commit introduced a bug using a binary search. Start by bisecting a session by providing two commit references: a good commit before the bug, and a bad commit after the bug. Generally, the bad commit is HEAD. # start the git bisect session $ git bisect start ...
Sometimes you may want to start a new activity while removing previous activities from the back stack, so the back button doesn't take you back to them. One example of this might be starting an app on the Login activity, taking you through to the Main activity of your application, but on logging out...
The built-in mtcars data frame contains information about 32 cars, including their weight, fuel efficiency (in miles-per-gallon), speed, etc. (To find out more about the dataset, use help(mtcars)). If we are interested in the relationship between fuel efficiency (mpg) and weight (wt) we may start p...
If a selection on multiple arguments for a type generic expression is wanted, and all types in question are arithmetic types, an easy way to avoid nested _Generic expressions is to use addition of the parameters in the controlling expression: int max_int(int, int); unsigned max_unsigned(unsigned, ...
$fruit1 = ['apples', 'pears']; $fruit2 = ['bananas', 'oranges']; $all_of_fruits = array_merge($fruit1, $fruit2); // now value of $all_of_fruits is [0 => 'apples', 1 => 'pears', 2 => 'bananas', 3 => 'oranges'] Note that array_merge will change numeric indexes, but overwrite string...
To delete a branch on the origin remote repository, you can use for Git version 1.5.0 and newer git push origin :<branchName> and as of Git version 1.7.0, you can delete a remote branch using git push origin --delete <branchName> To delete a local remote-tracking branch: git bra...
The function is_array() returns true if a variable is an array. $integer = 1337; $array = [1337, 42]; is_array($integer); // false is_array($array); // true You can type hint the array type in a function to enforce a parameter type; passing anything else will result in a fatal error. funct...
The current stable version of scikit-learn requires: Python (>= 2.6 or >= 3.3), NumPy (>= 1.6.1), SciPy (>= 0.9). For most installation pip python package manager can install python and all of its dependencies: pip install scikit-learn However for linux systems it is recomm...
Arrays can have the allocatable attribute: ! One dimensional allocatable array integer, dimension(:), allocatable :: foo ! Two dimensional allocatable array real, dimension(:,:), allocatable :: bar This declares the variable but does not allocate any space for it. ! We can specify the bounds...
Jumping to characters f{char} - move to the next occurrence of {char} to the right of the cursor on the same line F{char} - move to the next occurrence of {char} to the left of the cursor on the same line t{char} - move to the left of the next occurrence of {char} to the right of the cursor on th...
MKLocalSearch allows users to search for location using natural language strings like "gym". Once the search get completed, the class returns a list of locations within a specified region that match the search string. Search results are in form of MKMapItem within MKLocalSearchResponse ob...
if ($PSCmdlet.ShouldProcess("Target of action")) { # Do the thing } When using -WhatIf: What if: Performing the action "Invoke-MyCmdlet" on target "Target of action" When using -Confirm: Are you sure you want to perform this action? Performing operation &qu...

Page 2 of 21