(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| /** | |
| * Requires node v0.7.7 or greater. | |
| * | |
| * To connect: $ curl -sSNT. localhost:8000 | |
| */ | |
| var http = require('http') | |
| , repl = require('repl') | |
| , buf0 = new Buffer([0]) |
| 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" |
(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
| // Compile with $ gcc -o lmutracker lmu.m -framework IOKit -framework CoreFoundation -framework Foundation | |
| // Usage: ./lmu [now] | |
| // Prints out the value from the ambient light sensor and the back light LED every 1/10 of a second. Optionally print just one value. | |
| // Inspired by the code found at | |
| // http://google-mac-qtz-patches.googlecode.com/svn-history/r5/trunk/AmbientLightSensor | |
| // and http://osxbook.com/book/bonus/chapter10/light/ | |
| // and http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Archives/Computing/2010_February_10#Mac_OS_X_keyboard_backlight_drivers | |
| // http://forums.macrumors.com/showthread.php?t=1133446 | |
| #include <stdio.h> |
| #!/usr/bin/env zsh | |
| git show-branch -a \ | |
| | grep '\*' \ | |
| | grep -v `git rev-parse --abbrev-ref HEAD` \ | |
| | head -n1 \ | |
| | sed 's/.*\[\(.*\)\].*/\1/' \ | |
| | sed 's/[\^~].*//' | |
| # How it works: |
| [marking boo 0x168ec4f7ae88 for recompilation, reason: small function, ICs with typeinfo: 1/8 (12%)] | |
| Analyzing block B0 | |
| Initial inferred range of 1 (Constant) set to [-2147483648,2147483647] | |
| Initial inferred range of 54 (Constant) set to [1,1] | |
| Initial inferred range of 15 (Constant) set to [-2147483648,2147483647] | |
| Initial inferred range of 2 (ArgumentsObject) set to [-2147483648,2147483647] | |
| Initial inferred range of 3 (Parameter) set to [-2147483648,2147483647] | |
| Initial inferred range of 4 (Context) set to [-2147483648,2147483647] | |
| Analyzing block B1 | |
| Initial inferred range of 10 (LoadGlobalCell) set to [-2147483648,2147483647] |
| # alias to edit commit messages without using rebase interactive | |
| # example: git reword commithash message | |
| reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f" | |
| # git alias to tag and push a version | |
| tagpush = "!f(){ t=${1#v}; git tag v$t && git push origin v$t; }; f" | |
| # git alias to download single file from a repo in format of user/repo file | |
| fetch-file = "!f() { out=\"${4:-$(basename \"$2\")}\"; if gh api \"repos/$1/contents/$2\" ${3:+-f ref=$3} --jq '.content' 2>/dev/null | base64 --decode > \"$out\" 2>/dev/null; then echo \"Downloaded $2 → $out\"; else echo \"Failed\"; rm -f \"$out\"; fi; }; f" |
Browserify is a tool that allows us to write node-style modules that compile for use in the browser. Like node, we write our modules in separate files, exporting external methods and properties using the module.exports and exports variables
generator-browserify is a generator with a Browserify setup, offering choices between Gulp or Grunt and Foundation or Bootstrap.
generator-angular-with-browserify is a generator for bundling Angular.js with Browserify
| To enable window.gc() on Chrome browser console you just need to start Chrome like this: | |
| > /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --js-flags="--expose-gc" --enable-memory-info | |
| Those flags enable the following console API, very usefull to debug memory leaks: | |
| > console.memory // print memory information | |
| > window.gc() // force garbage collection |