| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)
Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.
(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)
##Option 1: Using jQuery 1.7's $.Callbacks() feature:
| { | |
| // Settings | |
| "passfail" : false, // Stop on first error. | |
| "maxerr" : 10000, // Maximum error before stopping. | |
| // Predefined globals whom JSHint will ignore. | |
| "browser" : true, // Standard browser globals e.g. `window`, `document`. | |
| "node" : false, |
| 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" |
| { | |
| "jshint_options" : | |
| { | |
| "adsafe": false, | |
| "bitwise": false, | |
| "newcap": true, | |
| "eqeqeq": true, | |
| "immed": true, | |
| "nomen": false, | |
| "onevar": true, |
| #!/usr/bin/env sh | |
| # Download lists, unpack and filter, write to stdout | |
| curl -s https://www.iblocklist.com/lists.php \ | |
| | sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \ | |
| | xargs wget -O - \ | |
| | gunzip \ | |
| | egrep -v '^#' |
Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist.
Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')| #!/usr/bin/env bash | |
| # MIT © Sindre Sorhus - sindresorhus.com | |
| # git hook to run a command after `git pull` if a specified file was changed | |
| # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
| check_run() { | |
| echo "$changed_files" | grep --quiet "$1" && eval "$2" |
| // Y-combinator with memoization | |
| var Yc = function (f, x) { | |
| x = x || {}; | |
| return function () { | |
| var y = JSON.stringify([].slice.call(arguments)); | |
| return x[y] || (x[y] = f(function (z) { | |
| return Yc(f, x)(z); | |
| }).apply(this, arguments)); |