most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| // Create the module | |
| var controllerModule = require('dashboardController').boot(_params); | |
| // Test to see if the parent controller's load method or dashboardController method fires | |
| controllerModule.load(); | |
| // Test to see other properties | |
| Ti.API.info(controllerModule.works); |
| // this sets the background color of the master UIView (when there are no windows/tab groups on it) | |
| Titanium.UI.setBackgroundColor('#000'); | |
| // create tab group | |
| var tabGroup = Titanium.UI.createTabGroup(); | |
| // | |
| // create base UI tab and root window | |
| // |
| function removeAllChildren(viewObject){ | |
| //copy array of child object references because view's "children" property is live collection of child object references | |
| var children = viewObject.children.slice(0); | |
| for (var i = 0; i < children.length; ++i) { | |
| viewObject.remove(children[i]); | |
| } | |
| } |
An introduction to curl using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
| 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" |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| "use strict"; | |
| // `f` is assumed to sporadically fail with `TemporaryNetworkError` instances. | |
| // If one of those happens, we want to retry until it doesn't. | |
| // If `f` fails with something else, then we should re-throw: we don't know how to handle that, and it's a | |
| // sign something went wrong. Since `f` is a good promise-returning function, it only ever fulfills or rejects; | |
| // it has no synchronous behavior (e.g. throwing). | |
| function dontGiveUp(f) { | |
| return f().then( | |
| undefined, // pass through success |