Tutorial by Examples

To create a variable in Python, all you need to do is specify the variable name, and then assign a value to it. <variable name> = <value> Python uses = to assign values to variables. There's no need to declare a variable in advance (or to assign a data type to it), assigning a value ...
Install the svn client to start collaborating on the project that is using Subversion as its version control system. To install Subversion, you can build it yourself from a source code release or download a binary package pre-built for your operating system. The list of sites where you can obtain a...
4.0 To uppercase $ v="hello" # Just the first character $ printf '%s\n' "${v^}" Hello # All characters $ printf '%s\n' "${v^^}" HELLO # Alternative $ v="hello world" $ declare -u string="$v" $ echo "$string" HELLO WORLD To l...
A positive lookahead (?=123) asserts the text is followed by the given pattern, without including the pattern in the match. Similarly, a positive lookbehind (?<=123) asserts the text is preceded by the given pattern. Replacing the = with ! negates the assertion. Input: 123456 123(?=456) mat...
A lookbehind can be used at the end of a pattern to ensure it ends or not in a certain way. ([a-z ]+|[A-Z ]+)(?<! ) matches sequences of only lowercase or only uppercase words while excluding trailing whitespace.
Ruby offers the expected if and else expressions for branching logic, terminated by the end keyword: # Simulate flipping a coin result = [:heads, :tails].sample if result == :heads puts 'The coin-toss came up "heads"' else puts 'The coin-toss came up "tails"' end ...
In Ruby, there are exactly two values which are considered "falsy", and will return false when tested as a condition for an if expression. They are: nil boolean false All other values are considered "truthy", including: 0 - numeric zero (Integer or otherwise) "&qu...
Number('0') === 0 Number('0') will convert the string ('0') into a number (0) A shorter, but less clear, form: +'0' === 0 The unary + operator does nothing to numbers, but converts anything else to a number. Interestingly, +(-12) === -12. parseInt('0', 10) === 0 parseInt('0', 10) will c...
String(0) === '0' String(0) will convert the number (0) into a string ('0'). A shorter, but less clear, form: '' + 0 === '0'
In most environments, console.table() can be used to display objects and arrays in a tabular format. For example: console.table(['Hello', 'world']); displays like: (index)value0"Hello"1"world" console.table({foo: 'bar', bar: 'baz'}); displays like: (index)value"fo...
If you want to use a pipe character (|) in the content of a cell you'll need to escape it with a backslash. Column | Column ------ | ------ \| Cell \|| \| Cell \| This results in the following table: ColumnColumn| Cell || Cell |
When ASP.NET handles a request, a thread is assigned from the thread pool and a request context is created. The request context contains information about the current request which can be accessed through the static HttpContext.Current property. The request context for the request is then assigned t...
Most browsers support using color keywords to specify a color. For example, to set the color of an element to blue, use the blue keyword: .some-class { color: blue; } CSS keywords are not case sensitive—blue, Blue and BLUE will all result in #0000FF. Color Keywords Color nameHex valueRGB...
Background CSS colors may also be represented as a hex triplet, where the members represent the red, green and blue components of a color. Each of these values represents a number in the range of 00 to FF, or 0 to 255 in decimal notation. Uppercase and/or lowercase Hexidecimal values may be used (i...
RGB is an additive color model which represents colors as mixtures of red, green, and blue light. In essence, the RGB representation is the decimal equivalent of the Hexadecimal Notation. In Hexadecimal each number ranges from 00-FF which is equivalent to 0-255 in decimal and 0%-100% in percentages....
HSL stands for hue ("which color"), saturation ("how much color") and lightness ("how much white"). Hue is represented as an angle from 0° to 360° (without units), while saturation and lightness are represented as percentages. p { color: hsl(240, 100%, 50%); /* B...
currentColor returns the computed color value of the current element. Use in same element Here currentColor evaluates to red since the color property is set to red: div { color: red; border: 5px solid currentColor; box-shadow: 0 0 5px currentColor; } In this case, specifyin...
The Edges The browser creates a rectangle for each element in the HTML document. The Box Model describes how the padding, border, and margin are added to the content to create this rectangle. Diagram from CSS2.2 Working Draft The perimeter of each of the four areas is called an edge. Each edge ...
Given a function that accepts a Node-style callback, fooFn(options, function callback(err, result) { ... }); you can promisify it (convert it to a promise-based function) like this: function promiseFooFn(options) { return new Promise((resolve, reject) => fooFn(options, (err, re...
The Problem The abstract equality and inequality operators (== and !=) convert their operands if the operand types do not match. This type coercion is a common source of confusion about the results of these operators, in particular, these operators aren't always transitive as one would expect. &...

Page 77 of 1336