Invokation sequence of React.js Component Lifecycle Methods under four distinct conditions:
- componentWillMount
- render
- componentDidMount
Invokation sequence of React.js Component Lifecycle Methods under four distinct conditions:
I hereby claim:
To claim this, I am signing this object:
util = require('./util') | |
applyStyle = (elem, style) -> | |
if typeof style is 'string' | |
elem.setAttribute('style', style) | |
else | |
elem.style[key] = val for own key, val of style | |
return |
package lazy | |
import ( | |
"sync" | |
"time" | |
) | |
type Connection struct { | |
sync.Mutex | |
conn interface{} |
- (CALayer*)layerFromResiableImage:(UIImage*)image { | |
CGSize size = [image size]; | |
UIEdgeInsets insets = [image capInsets]; | |
CALayer *layer = [CALayer layer]; | |
[layer setContents:(id)[image CGImage]]; | |
layer.contentsCenter = CGRectMake(insets.left / size.width, insets.top / size.height, | |
1.0/size.width, 1.0 / size.height); | |
return layer; | |
} |
class EventEmitter | |
on: (name, listener) -> | |
listeners = (@_eventListeners ?= {})[name] ?= [] | |
listeners.push listener | |
off: (name, listener) -> | |
if listeners = @_eventListeners?[name] | |
index = listeners.indexOf listener | |
listeners[index] = null if index >= 0 |
[localhost] local: npm outdated -g | |
grunt-cli /Users/don/.nvm/v0.10.21/lib/node_modules/grunt-cli current=0.1.9 wanted=0.1.10 latest=0.1.10 | |
nodeunit /Users/don/.nvm/v0.10.21/lib/node_modules/nodeunit current=0.8.1 wanted=0.8.2 latest=0.8.2 | |
stylus /Users/don/.nvm/v0.10.21/lib/node_modules/stylus current=0.39.4 wanted=0.40.0 latest=0.40.0 | |
generator-webapp /Users/don/.nvm/v0.10.21/lib/node_modules/generator-webapp current=0.4.3 wanted=0.4.4 latest=0.4.4 | |
uglify-js /Users/don/.nvm/v0.10.21/lib/node_modules/uglify-js current=2.4.2 wanted=2.4.3 latest=2.4.3 | |
yeoman-generator /Users/don/.nvm/v0.10.21/lib/node_modules/generator-mocha/node_modules/yeoman-generator current=0.10.5 wanted=0.10.5 latest=0.14.0-rc.1 | |
commander /Users/don/.nvm/v0.10.21/lib/node_modules/dox/node_modules/commander current=0.6.1 wanted=0.6.1 latest=2.0.0 | |
stylus /Users/don/.nvm/v0.10.21/lib/node_modules/serve/node_modules/stylus current=0.39.4 wanted=0.40.0 latest=0.40.0 | |
commander /Users/don/.nvm/v0.10.21/lib/node_modules/serve/node_modules/command |
// Convert JavaScript string to UTF-8 bytes in modern browsers using the File API | |
// callback function will be called with UTF8 bytes in Uint8Array | |
// | |
// jsPerf test reveals this method is slower than looping over each character. | |
// http://jsperf.com/convert-javascript-string-to-utf-8-bytes-using-file-api | |
function toUTF8(string, cb) { | |
var reader = new FileReader(); | |
reader.onload = function(evt) { | |
cb(new Uint8Array(reader.result)); |
FS = require("fs") | |
Path = require("path") | |
Cheerio = require("cheerio") | |
Hogan = require("hogan.js") | |
htmlFile = process.argv[2] | |
html = FS.readFileSync process.argv[2], encoding: "utf8" | |
# console.log html |
$ npm -v | |
1.3.0 | |
don@ironforge:~ | |
$ npm outdated -g | |
superagent@0.9.7 /usr/local/lib/node_modules/c-pm/node_modules/superagent current=0.9.10 | |
optimist@0.3.5 /usr/local/lib/node_modules/uglify-js/node_modules/optimist current=0.3.7 | |
commander@0.5.2 /usr/local/lib/node_modules/docco/node_modules/commander current=1.2.0 | |
less@1.3.0 /usr/local/lib/node_modules/recess/node_modules/less current=1.3.3 | |
yeoman-generator@0.11.1 /usr/local/lib/node_modules/yo/node_modules/yeoman-generator current=0.11.4 |