Tutorial by Examples

Autocommand groups are good for organization but they can be useful for debugging too. Think of them as small namespaces that you can enable/disable at will. Example augroup MyGroup " Clear the autocmds of the current group to prevent them from piling " up each time you rel...
if v:version >= 704 " Do something if Vim is the right version. endif if has('patch666') " Do something if Vim has the right patch-level. endif if has('feature') " Do something if Vim is built with 'feature'. endif See :help has-patch and :help feature-li...
Some formats can take additional parameters, such as the width of the formatted string, or the alignment: >>> '{:.>10}'.format('foo') '.......foo' Those can also be provided as parameters to format by nesting more {} inside the {}: >>> '{:.>{}}'.format('foo', 10) '.......
By default the built-in Request Localization middleware only supports setting culture via query, cookie or Accept-Language header. This example shows how create a middleware which allows to set the culture as part of the path like in /api/en-US/products. This example middleware assumes the locale t...
Avoid Ambiguity The name of classes, structures, functions and variables should avoid ambiguity. Example: extension List { public mutating func remove(at position: Index) -> Element { // implementation } } The function call to this function will then look like this: li...
Using natural language Functions calls should be close to natural English language. Example: list.insert(element, at: index) instead of list.insert(element, position: index) Naming Factory Methods Factory methods should begin with the prefix `make`. Example: factory.makeObject() ...
Types & Protocols Type and protocol names should start with an uppercase letter. Example: protocol Collection {} struct String {} class UIView {} struct Int {} enum Color {} Everything else... Variables, constants, functions and enumeration cases should start with a lowercase letter. Exa...
By default, one should subscribe to event using inspector, but sometimes it's better to do it in code. In this example we subscribe to click event of a button in order to handle it. using UnityEngine; using UnityEngine.UI; [RequireComponent(typeof(Button))] public class AutomaticClickHandler :...
In case we want to use enum with more information and not just as constant values, and we want to be able to compare two enums. Consider the following example: public enum Coin { PENNY(1), NICKEL(5), DIME(10), QUARTER(25); private final int value; Coin(int value){ this....
The angular.equals function compares and determines if 2 objects or values are equal, angular.equals performs a deep comparison and returns true if and only if at least 1 of the following conditions is met. angular.equals(value1, value2) If the objects or values pass the === comparison If b...
The function angular.isString returns true if the object or value given to it is of the type string angular.isString(value1) Examples angular.isString("hello") // true angular.isString([1, 2]) // false angular.isString(42) // false This is the equivalent of performing typeof s...
The angular.isArray function returns true if and only if the object or value passed to it is of the type Array. angular.isArray(value) Examples angular.isArray([]) // true angular.isArray([2, 3]) // true angular.isArray({}) // false angular.isArray(17) // false It is the equivalent of ...
<svg xmlns="http://www.w3.org/2000/svg"> <text x="40" y="60" font-size="28">Hello World!</text> </svg> The x and y coordinate specifies the position of the bottom-left corner of the text (unless text-anchor has been modified). ...
Using the baseline-shift parameter, you can specify super- or subscript. But this is not supported by all major browsers. <svg xmlns="http://www.w3.org/2000/svg"> <text x="10" y="20">x<tspan baseline-shift="super">2</tspan></te...
The rotate property rotates each character by the specified angle. <svg xmlns="http://www.w3.org/2000/svg"> <text x="10" y="20" rotate="30">Each character is rotated</text> </svg> To rotate the whole text element, you have to ...
In cases such as restoring a database dump, or otherwise wishing to push some information through a pipe from the host, you can use the -i flag as an argument to docker run or docker exec. E.g., assuming you want to put to a containerized mariadb client a database dump that you have on the host, in...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <line x1="10" y1="10" x2="100" y2="100" stroke="red" stroke-width="10" /> <line x1="100" y1="10&...
docker inspect <image> The output is in JSON format. You can use jq command line utility to parse and print only the desired keys. docker inspect <image> | jq -r '.[0].Author' The above command will shows author name of the images.
Parameters AttributeRequiredTypeDefaultDescriptionindextruestringVariable name for the loop's index. Defaults to the variables scope.fromtruenumericStarting value for the index.totruenumericEnding value for the index.stepfalsenumeric1Value by which to increase or decrease the index per iteration.Ba...
Tag syntax Parameters AttributeRequiredTypeDefaultDescriptionconditiontruestringCondition that manages the loop. Cannot contain math symbols like <, > or =. Must use ColdFusion text implementations like less than, lt, greater than, gt, equals or eq. Final value of x is 5. <cfset x = 0 /...

Page 393 of 1336