Tutorial by Examples: v

You can get the value of an entry in the dictionary using the 'Item' property: Dim extensions As New Dictionary(Of String, String) From { { "txt", "notepad" }, { "bmp", "paint" }, { "doc", "winword" } } Dim program As St...
One of the most common things you'll need to do in the command prompt is navigate your file system. To do this, we'll utilize the cd and dir keywords. Start by opening up a command prompt using one of the methods mentioned here. You most likely see something similar to what's below, where UserNam...
Vectors in R can have different types (e.g. integer, logical, character). The most general way of defining a vector is by using the function vector(). vector('integer',2) # creates a vector of integers of size 2. vector('character',2) # creates a vector of characters of size 2. vector('logical',2...
Creating a custom directive with isolated scope will separate the scope inside the directive from the outside scope, in order to prevent our directive from accidentally change the data in the parent scope and restricting it from reading private data from the parent scope. To create an isolated scop...
Use Kernel.inspect to convert anything to string. iex> Kernel.inspect(1) "1" iex> Kernel.inspect(4.2) "4.2" iex> Kernel.inspect %{pi: 3.14, name: "Yos"} "%{pi: 3.14, name: \"Yos\"}"
Some languages include a list data structure. Common Lisp, and other languages in the Lisp family, make extensive use of lists (and the name Lisp is based on the idea of a LISt Processor). However, Common Lisp doesn't actually include a primitive list datatype. Instead, lists exist by convention....
Swift timer.invalidate() Objective-C [timer invalidate]; This will stop the timer from firing. Must be called from the thread the timer was created in, see Apple's notes: You must send this message from the thread on which the timer was installed. If you send this message from another thr...
The following values are considered falsey, in that they evaluate to False when applied to a boolean operator. None False 0, or any numerical value equivalent to zero, for example 0L, 0.0, 0j Empty sequences: '', "", (), [] Empty mappings: {} User-defined types where the __bool__ o...
This query gets all overlapping appointments from six to ten. Appointment.objects.filter(time_span__overlap=(6, 10))
To remove extraneous packages (packages that are installed but not in dependency list) run the following command: npm prune To remove all dev packages add --production flag: npm prune --production More on it
Removing duplicate values in a list can be done by converting the list to a set (that is an unordered collection of distinct objects). If a list data structure is needed, then the set can be converted back to a list using the function list(): names = ["aixk", "duke", "edik&...
It is possible, inside a closure, to use an external variable with the special keyword use. For instance: <?php $quantity = 1; $calculator = function($number) use($quantity) { return $number + $quantity; }; var_dump($calculator(2)); // Shows "3" You can go further by ...
In general, an observer is a class with a specific method being called when an action on the observed object occurs. In certain situations, closures can be enough to implement the observer design pattern. Here is a detailed example of such an implementation. Let's first declare a class whose purpos...
When you run git checkout on a commit (specified by hash or ref) you're telling git to make your working directory look like how it did when the snapshot was taken. Update the files in the working directory to match the tree inside the commit Update HEAD to point to the specified hash or ref ...
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
Common Lisp already has a reverse function, but if it didn't, then it could be implemented easily using reduce. Given a list like (1 2 3) === (cons 1 (cons 2 (cons 3 '()))) the reversed list is (cons 3 (cons 2 (cons 1 '()))) === (3 2 1) That may not be an obvious use of reduce, but if we ha...
You can use curl: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash Or you can use wget: wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
To verify that nvm has been installed, do: command -v nvm which should output 'nvm' if the installation was successful.
Listing available remote versions for installation nvm ls-remote Installing a remote version nvm install <version> For example nvm install 0.10.13
To list available local versions of node through NVM: nvm ls For example, if nvm ls returns: $ nvm ls v4.3.0 v5.5.0 You can switch to v5.5.0 with: nvm use v5.5.0

Page 69 of 296