Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/bin/sh | |
| ProgName=$(basename $0) | |
| sub_help(){ | |
| echo "Usage: $ProgName <subcommand> [options]\n" | |
| echo "Subcommands:" | |
| echo " bar Do bar" | |
| echo " baz Run baz" | |
| echo "" |
| /*------------------------------------------ | |
| Responsive Grid Media Queries - 1280, 1024, 768, 480 | |
| 1280-1024 - desktop (default grid) | |
| 1024-768 - tablet landscape | |
| 768-480 - tablet | |
| 480-less - phone landscape & smaller | |
| --------------------------------------------*/ | |
| @media all and (min-width: 1024px) and (max-width: 1280px) { } | |
| @media all and (min-width: 768px) and (max-width: 1024px) { } |
| # --------------------------------------------------------------------------- | |
| # | |
| # Description: This file holds all my BASH configurations and aliases | |
| # | |
| # Sections: | |
| # 1. Environment Configuration | |
| # 2. Make Terminal Better (remapping defaults and adding functionality) | |
| # 3. File and Folder Management | |
| # 4. Searching | |
| # 5. Process Management |
| # http://stackoverflow.com/questions/5735666/execute-bash-script-from-url | |
| bash <(curl -s http://mywebsite.com/myscript.txt) | |
| # http://stackoverflow.com/questions/4642915/passing-parameters-to-bash-when-executing-a-script-fetched-by-curl | |
| curl http://foo.com/script.sh | bash -s arg1 arg2 |
Recommendations of unit types per media type:
| Media | Recommended | Occasional use | Infrequent use | Not recommended |
|---|---|---|---|---|
| Screen | em, rem, % | px | ch, ex, vw, vh, vmin, vmax | cm, mm, in, pt, pc |
| em, rem, % | cm, mm, in, pt, pc | ch, ex | px, vw, vh, vmin, vmax |
| def multi(dispatch_fn): | |
| def _inner(*args, **kwargs): | |
| return _inner.__multi__.get( | |
| dispatch_fn(*args, **kwargs), | |
| _inner.__multi_default__ | |
| )(*args, **kwargs) | |
| _inner.__multi__ = {} | |
| _inner.__multi_default__ = lambda *args, **kwargs: None # Default default | |
| return _inner |
| // module with classes and logic for working with local storage in browsers via JavaScript | |
| // see also: http://professorweb.ru/my/html/html5/level5/5_1.php | |
| module StorageHelper { | |
| export interface IStorageItem { | |
| key: string; | |
| value: any; | |
| } | |
| export class StorageItem { | |
| key: string; |
| /* bling.js */ | |
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |