Tutorial by Examples: e

To start, import the zipfile module, and set the filename. import zipfile filename = 'zipfile.zip' Working with zip archives is very similar to working with files, you create the object by opening the zipfile, which lets you work on it before closing the file up again. zip = zipfile.ZipFile(fi...
Typedefs are declarations which have the keyword typedef in front and before the type. E.g.: typedef int (*(*t0)())[5]; (you can technically put the typedef after the type too - like this int typedef (*(*t0)())[5]; but this is discouraged) The above declarations declares an identifier for a typ...
import scala.util.parsing.combinator._ class SimpleParser extends RegexParsers { // Define a grammar rule, turn it into a regex, and apply it the input. def word: Parser[String] = """[A-Z][a-z]+""".r ^^ { _.toString } } object SimpleParser extends SimplePar...
The following uses a variable with a for loop to rename a group of files. SetLocal EnableDelayedExpansion for %%j in (*.*) do ( set filename=%%~nj set filename=!filename:old=new! set filename=Prefix !filename! set filename=!filename! Suffix ren "%%j" "!filename!%%~x...
Sometimes you need to call a Tcl command from your expression. For example, supposing you need the length of a string in it. To do that, you just use a [...] sequence in the expression: set halfTheStringLength [expr { [string length $theString] / 2 }] You can call any Tcl command this way, but i...
Create an .html file containing this snippet: <!DOCTYPE html> <meta charset="utf-8"> <body> <script src="//d3js.org/d3.v4.min.js"></script> <script> d3.select("body").append("span") .text("Hello, world!&quo...
This example is based on a blog post by Nicolas Hery. It utilizes ES6 classes and ReactJS's lifecycle methods to keep the D3 component updated d3_react.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Hello, d3React!</title>...
CSS div { width: 200px; height: 200px; background: url(http://lorempixel.com/200/200/abstract/6); mask-image: radial-gradient(circle farthest-side at center, transparent 49%, white 50%); /* check remarks before using */ } HTML In the above example, a transparent circle is created...
CSS div { /* check remarks before usage */ height: 200px; width: 400px; background-image: url(http://lorempixel.com/400/200/nature/4); mask-image: linear-gradient(to top right, transparent 49.5%, white 50.5%), linear-gradient(to top left, transparent 49.5%, white 50.5%), linear-gradient...
The first release of SciPy, vsn 0.10, was released on August 14th 2001. The current release of SciPy (correct at 26th July 2016) is v 0.17 (stable) with v .18 forthcoming soon. Details of former releases are listed here
When inheriting from any base class, only one partial class needs to have the base class specified. // PartialClass1.cs public partial class PartialClass : BaseClass {} // PartialClass2.cs public partial class PartialClass {} You can specify the same base class in more than one partial clas...
$ git show dae86e1950b1277e545cee180551750029cfe735 $ git show dae86e19 You can specify revision (or in truth any object: tag, tree i.e. directory contents, blob i.e. file contents) using SHA-1 object name, either full 40-byte hexadecimal string, or a substring that is unique to the repository. ...
$ git log master # specify branch $ git show v1.0 # specify tag $ git show HEAD # specify current branch $ git show origin # specify default remote-tracking branch for remote 'origin' You can specify revision using a symbolic ref name, which includes branches (for example 'master'...
$ git show # equivalent to 'git show HEAD' 'HEAD' names the commit on which you based the changes in the working tree, and is usually the symbolic name for the current branch. Many (but not all) commands that take revision parameter defaults to 'HEAD' if it is missing.
$ git show @{1} # uses reflog for current branch $ git show master@{1} # uses reflog for branch 'master' $ git show HEAD@{1} # uses 'HEAD' reflog A ref, usually a branch or HEAD, followed by the suffix @ with an ordinal specification enclosed in a brace pair (e.g. {1}, {1...
$ git show master@{yesterday} $ git show HEAD@{5 minutes ago} # or HEAD@{5.minutes.ago} A ref followed by the suffix @ with a date specification enclosed in a brace pair (e.g. {yesterday}, {1 month 2 weeks 3 days 1 hour 1 second ago} or {1979-02-26 18:30:00}) specifies the value of the ref at ...
$ git log @{upstream}.. # what was done locally and not yet published, current branch $ git show master@{upstream} # show upstream of branch 'master' The suffix @{upstream} appended to a branchname (short form <branchname>@{u}) refers to the branch that the branch specified by branc...
$ git reset --hard HEAD^ # discard last commit $ git rebase --interactive HEAD~5 # rebase last 4 commits A suffix ^ to a revision parameter means the first parent of that commit object. ^<n> means the <n>-th parent (i.e. <rev>^ is equivalent to <rev>^1). A...
In some cases the behavior of a command depends on whether it is given branch name, tag name, or an arbitrary revision. You can use "de-referencing" syntax if you need the latter. A suffix ^ followed by an object type name (tag, commit, tree, blob) enclosed in brace pair (for example v0.9...
$ git show HEAD^{/fix nasty bug} # find starting from HEAD $ git show ':/fix nasty bug' # find starting from any branch A colon (':'), followed by a slash ('/'), followed by a text, names a commit whose commit message matches the specified regular expression. This name returns the younge...

Page 441 of 1191