Tutorial by Examples: f

Since PHP7, it is possible to bind a closure just for one call, thanks to the call method. For instance: <?php class MyClass { private $property; public function __construct($propertyValue) { $this->property = $propertyValue; } } $myClosure = function() ...
HEAD is a special ref. It always points to the current object. You can see where it's currently pointing by checking the .git/HEAD file. Normally, HEAD points to another ref: $cat .git/HEAD ref: refs/heads/mainline But it can also point directly to an object: $ cat .git/HEAD 4bb6f98a223abc...
A ref is essentially a pointer. It's a name that points to an object. For example, "master" --> 1a410e... They are stored in `.git/refs/heads/ in plain text files. $ cat .git/refs/heads/mainline 4bb6f98a223abc9345a0cef9200562333 This is commonly what are called branches. Howeve...
Running git reset --hard moves refs to the specified hash/ref. Moving MyBranch to b8dc53: $ git checkout MyBranch # moves HEAD to MyBranch $ git reset --hard b8dc53 # makes MyBranch point to b8dc53
Running git checkout -b <refname> will create a new ref that points to the current commit. $ cat .git/head 1f324a $ git checkout -b TestBranch $ cat .git/refs/heads/TestBranch 1f324a
Listing available remote versions for installation nvm ls-remote Installing a remote version nvm install <version> For example nvm install 0.10.13
Three methods are provided that offer the ability to strip leading and trailing characters from a string: str.strip, str.rstrip and str.lstrip. All three methods have the same signature and all three return a new string object with unwanted characters removed. str.strip([chars]) str.strip acts o...
Tips & Tricks to avoid nasty situations EC2 Instances and EBS Set IAM Roles. Unlike tags, the IAM Role is set once and for all on EC2 instanciation (even after 4 years) ! Try to identify and categorize beforehand your instances so you can give an them appropriate IAM roles. IAM Roles are ...
Consider the following component with one input myInput and an internal value called someInternalValue. Both of them are used in a component's template. import {Component, Input} from '@angular/core'; @Component({ template:` <div> <p>{{myInput}}</p> <p>{...
The following compares two files with diff using process substitution instead of creating temporary files. diff <(curl http://www.example.com/page1) <(curl http://www.example.com/page2)
This feeds a while loop with the output of a grep command: while IFS=":" read -r user _ do # "$user" holds the username in /etc/passwd done < <(grep "hello" /etc/passwd)
Problem: Some data needs to be passed to a scene loaded from a fxml. Solution Specify a controller using the fx:controller attribute and get the controller instance created during the loading process from the FXMLLoader instance used to load the fxml. Add methods for passing the data to the contr...
Problem: Some data needs to be passed to a scene loaded from a fxml. Solution Set the controller using the FXMLLoader instance used later to load the fxml. Make sure the controller contains the relevant data before loading the fxml. Note: in this case the fxml file must not contain the fx:contro...
Problem: Some data needs to be passed to a scene loaded from a fxml. Solution Specify a controller factory that is responsible for creating the controllers. Pass the data to the controller instance created by the factory. FXML <?xml version="1.0" encoding="UTF-8"?> &...
Aliasing types cuts down on boilerplate and enhances readability, but it is no more type-safe than the aliased type itself is. Consider the following: type alias Email = String type alias Name = String someEmail = "[email protected]" someName = "Benedict" sendEmail ...
A common task is to convert all columns of a data.frame to character class for ease of manipulation, such as in the cases of sending data.frames to a RDBMS or merging data.frames containing factors where levels may differ between input data.frames. The best time to do this is when the data is read ...
<!--- Define collection ---> <cfset attributes = { "name": "Sales", "type": "text", "value": "Connection" }> <!--- cfloop tag with attribute collection can be used to loop through the elements of a struc...
<cfscript> /*define collection*/ attributes = { "name": "Sales", "type": "text", "value": "Connection" }; for(attribute in attributes){ /* attribute variable will contain the key name of each key value ...
Each of Laravel's queue drivers are configured from the config/queue.php file. A queue driver is the handler for managing how to run a queued job, identifying whether the jobs succeeded or failed, and trying the job again if configured to do so. Out of the box, Laravel supports the following queue ...
Placeholders in the query string need to be set by using the set* methods: String sql = "SELECT * FROM EMP WHERE JOB = ? AND SAL > ?"; //Create statement to make your operations PreparedStatement statement = connection.prepareStatement(sql); statement.setString(1, "MANAGER&...

Page 107 of 457