Tutorial by Examples

:root { --red: #b00; --blue: #4679bd; --grey: #ddd; } .Bx1 { color: var(--red); background: var(--grey); border: 1px solid var(--red); }
:root { --W200: 200px; --W10: 10px; } .Bx2 { width: var(--W200); height: var(--W200); margin: var(--W10); }
Trailing spaces \s*$: This will match any (*) whitespace (\s) at the end ($) of the text Leading spaces ^\s*: This will match any (*) whitespace (\s) at the beginning (^) of the text Remarks \s is a common metacharacter for several RegExp engines, and is meant to capture whitespace characters (...
Raw direct IO file_get_contents and file_put_contents provide the ability to read/write from/to a file to/from a PHP string in a single call. file_put_contents can also be used with the FILE_APPEND bitmask flag to append to, instead of truncate and overwrite, the file. It can be used along with LO...
The <datalist> tag specifies a list of pre-defined options for an <input> element. It provide an "autocomplete" feature on <input> elements. Users will see a drop-down list of options as they write. <input list="Languages"> <datalist id="Langua...
In Python 2, <> is a synonym for !=; likewise, `foo` is a synonym for repr(foo). Python 2.x2.7 >>> 1 <> 2 True >>> 1 <> 1 False >>> foo = 'hello world' >>> repr(foo) "'hello world'" >>> `foo` "'hello world'"...
child.py import time def main(): print "starting work" time.sleep(1) print "work work work work work" time.sleep(1) print "done working" if __name__ == '__main__': main() parent.py import os def main(): for i in range(5):...
Suppose we have a list of teams, named like this: Team A, Team B, ..., Team Z. Then: Team [AB]: This will match either either Team A or Team B Team [^AB]: This will match any team except Team A or Team B We often need to match characters that "belong" together in some context or ano...
This example starts Notepad, waits for it to be closed, then gets its exit code. #include <Windows.h> int main() { STARTUPINFOW si = { 0 }; si.cb = sizeof(si); PROCESS_INFORMATION pi = { 0 }; // Create the child process BOOL success = CreateProcessW( L"C:...
Pass dynamic inventory to ansible-playbook: ansible-playbook -i inventory/dyn.py -l targethost my_playbook.yml python inventory/dyn.py should print out something like this: { "_meta": { "hostvars": { "10.1.0.10": { "ansible_user": ...
Available in Django 1.9+ from django.contrib.postgres.fields import JSONField from django.db import models class IceCream(models.Model): metadata = JSONField() You can add the normal **options if you wish. ! Note that you must put 'django.contrib.postgres' in INSTALLED_APPS in your s...
Pass data in native Python form, for example list, dict, str, None, bool, etc. IceCream.objects.create(metadata={ 'date': '1/1/2016', 'ordered by': 'Jon Skeet', 'buyer': { 'favorite flavor': 'vanilla', 'known for': ['his rep on SO', 'writing a book'] }, ...
IceCream.objects.filter(metadata__ordered_by='Guido Van Rossum')
Get all ice cream cones that were ordered by people liking chocolate: IceCream.objects.filter(metadata__buyer__favorite_flavor='chocolate') See the note in the "Remarks" section about chaining queries.
An integer will be interpreted as an index lookup. IceCream.objects.filter(metadata__buyer__known_for__0='creating stack overflow') See the note in the "Remarks" section about chaining queries.
Python 3.x3.0 Python 3 added a new keyword called nonlocal. The nonlocal keyword adds a scope override to the inner scope. You can read all about it in PEP 3104. This is best illustrated with a couple of code examples. One of the most common examples is to create function that can increment: def c...
To iterate all files, including in sub directories, use os.walk: import os for root, folders, files in os.walk(root_dir): for filename in files: print root, filename root_dir can be "." to start from current directory, or any other path to start from. Python 3.x3.5 If ...
Using subprocess.Popen give more fine-grained control over launched processes than subprocess.call. Launching a subprocess process = subprocess.Popen([r'C:\path\to\app.exe', 'arg1', '--flag', 'arg']) The signature for Popen is very similar to the call function; however, Popen will return immedi...
vimtutor is an interactive tutorial covering the most basic aspects of text editing. On UNIX-like system, you can start the tutorial with: $ vimtutor On Windows, “Vim tutor” can be found in the “Vim 7.x” directory under “All Programs” in the Windows menu. See :help vimtutor for further details...
This assumes you have a twilio account and have purchased/reserved a phone number... If you are using bundler add the following line to your Gemfile to include twilio-ruby in your project: gem 'twilio-ruby' otherwise enter gem install twilio-ruby on the command line. You might need sudo if you'...

Page 215 of 1336