Tutorial by Examples: e

To create a patch, there are two steps. Make your changes and commit them. Run git format-patch <commit-reference> to convert all commits since the commit <commit-reference> (not including it) into patch files. For example, if patches should be generated from the latest two commit...
We can use git apply some.patch to have the changes from the .patch file applied to your current working directory. They will be unstaged and need to be committed. To apply a patch as a commit (with its commit message), use git am some.patch To apply all patch files to the tree: git am *.patch...
To list local branches that contain a specific commit or tag git branch --contains <commit> To list local and remote branches that contain a specific commit or tag git branch -a --contains <commit>
impl<K, V> Serialize for MyMap<K, V> where K: Serialize, V: Serialize { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer { let mut state = serializer.serialize_map(Some(self.len()))?; ...
// A Visitor is a type that holds methods that a Deserializer can drive // depending on what is contained in the input data. // // In the case of a map we need generic type parameters K and V to be // able to set the output type correctly, but don't require any state. // This is an example of a...
In build.sbt, make sure you include (here for Mysql and PostGreSQL): "mysql" % "mysql-connector-java" % "5.1.20", "org.postgresql" % "postgresql" % "9.3-1100-jdbc4", "com.typesafe.slick" %% "slick" % "3.1.1&...
First, make your class comply with the UISearchResultsUpdating protocol. class MyTableViewController: UITableViewController, UISearchResultsUpdating {} Add the search controller property: class MyTableViewController: UTableViewController, UISearchResultsUpdating { let searchController = UI...
import { Component } from '@angular/core'; import { Router , ROUTER_DIRECTIVES} from '@angular/router'; import { NgForm } from '@angular/forms'; @Component({ selector: 'login', template: ` <h2>Login</h2> <form #f="ngForm" (ngSubmit)="login(f.value,f....
First, you have to request authorization of location services let locationManager = CLLocationManager() locationManager.delegate = self locationManager.requestWhenInUseAuthorization() // OR locationManager.requestAlwaysAuthorization() Then you can get all iBeacons' information inside didRange...
Sometimes you may want to perform some additional actions to Auto Layout calculations done by UIKit itself. Example: when you have a UIView that has a maskLayer, you may need to update maskLayer as soon as Auto Layout changes UIView's frame // CustomView.m - (void)layoutSubviews { [super la...
Git shortlog is used to summarize the git log outputs and group the commits by author. By default, all commit messages are shown but argument --summary or -s skips the messages and gives a list of authors with their total number of commits. --numbered or -n changes the ordering from alphabetical (...
git log --pretty=format:"%ai" | awk '{print " : "$1}' | sort -r | uniq -c
git log --pretty=oneline |wc -l
for k in `git branch -a | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --`\\t"$k";done | sort
git ls-tree -r HEAD | sed -Ee 's/^.{53}//' | \ while read filename; do file "$filename"; done | \ grep -E ': .*text' | sed -E -e 's/: .*//' | \ while read filename; do git blame --line-porcelain "$filename"; done | \ sed -n 's/^author //p' | \ sort | uniq -c | sort -rn
class Example { void method(boolean error) { if (error) { Log.error("Error occurred!"); System.out.println("Error!"); } else { // Use braces since the other block uses braces. System.out.println("No error"); ...
To validate arguments to methods called on a mock, use the ArgumentCaptor class. This will allow you to extract the arguments into your test method and perform assertions on them. This example tests a method which updates the name of a user with a given ID. The method loads the user, updates the na...
NSURL *url = [NSURL URLWithString:@"http://www.example.com/images/apple-tree.jpg"]; NSString *fileName = [url lastPathComponent]; // fileName = "apple-tree.jpg"
Given a DataFrame: s1 = pd.Series([1,2,3]) s2 = pd.Series(['a','b','c']) df = pd.DataFrame([list(s1), list(s2)], columns = ["C1", "C2", "C3"]) print df Output: C1 C2 C3 0 1 2 3 1 a b c Lets add a new row, [10,11,12]: df = pd.DataFrame(np.array(...
Using the same example as Evaluating a NodeList in an XML document, here is how you would make multiple XPath calls efficiently: Given the following XML document: <documentation> <tags> <tag name="Java"> <topic name="Regular expression...

Page 554 of 1191