Identifiers (variables, functions) cannot be named any of these: "implements", "interface", "let", "package", "private", "protected", "public", "static", and "yield"
OctalLiterals are not allowed.
# opens the current git repo in tower if no argument is given | |
tower() { | |
if [[ "$#" > 0 ]]; then | |
gittower $@ | |
else | |
gittower `git rev-parse --show-toplevel` | |
fi | |
} |
# MAC manipulators | |
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`' | |
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE' |
// port of https://gist.github.com/909692 | |
// TODO: check char-map of https://github.com/jbroadway/urlify/blob/master/URLify.php for characters we've missed | |
// TODO: check performance against http://stackoverflow.com/questions/1946040/using-javascript-to-normalize-url-rewriting-strings-entered-by-users | |
var Urlifyer = function(options) { | |
var _key, _code, i, _source, _sources; | |
// Allow instantiation without the 'new' keyword | |
if (!(this instanceof Urlifyer)) { | |
return new Urlifyer(options); |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
# Route extension-less URLs to the equivalent *.html file. | |
# For instance: example.com/about = example.com/about.html | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^([^\.]+)$ $1.html [NC,L] | |
</IfModule> |
<?php | |
/* | |
consider decomposing the characters to "capture" more "obscure" characters such as ṩ | |
- http://www.php.net/manual/en/normalizer.normalize.php#92592 | |
*/ | |
/** | |
* Normalize a string to only contain alphanumeric characters and dashes. | |
* |
#!/bin/bash | |
sudo find '/Applications/Google Chrome.app' \ | |
\( -name inspector.css -or -name devTools.css \) \ | |
-exec sh -c 'cat >> $1 <<WAT | |
/* Added on `date` */ | |
#drawer .monospace, | |
#drawer .source-code { | |
font-size: 18px !important; |
/** | |
* $.unserialize | |
* | |
* Takes a string in format "param1=value1¶m2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array. | |
* | |
* Example: | |
* | |
* Input: param1=value1¶m2=value2 | |
* Return: { param1 : value1, param2: value2 } | |
* |