Sometimes you'll have objects that manage state along with event handling. This happens frequently in MVC apps. Let's start with a messy example:
var Launcher = function(rocket) {
this.rocket = rocket
}
Launcher.prototype.isReady = function() {
| // Place user-specific overrides in this file, to ensure they're preserved | |
| // when upgrading | |
| { | |
| "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"] | |
| } |
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>Backbone Memory Management</title> | |
| <link href="style.css"> | |
| <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet"> | |
| </head> | |
| <body> | |
| <div id="app" class="container"> | |
| <h1>Zombie Destroyer 3000</h1> |
| #!/bin/sh | |
| cd /usr/local/share | |
| wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-i686.tar.bz2 | |
| tar -xjf /usr/local/share/phantomjs-1.9.0-linux-i686.tar.bz2 | |
| sudo ln -sf /usr/local/share/phantomjs-1.9.0-linux-i686/bin/phantomjs /usr/local/bin/phantomjs | |
| git clone git://github.com/n1k0/casperjs.git /usr/local/src/casperjs | |
| cd /usr/local/src/casperjs | |
| git checkout tags/1.0.2 | |
| ln -sf /usr/local/src/casperjs/bin/casperjs /usr/local/bin/casperjs |
| #!/bin/sh | |
| cd /usr/local/src | |
| wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2 | |
| wget https://github.com/n1k0/casperjs/tarball/1.0.2 | |
| tar xvjpf phantomjs-1.9.0-linux-x86_64.tar.bz2tar zxvf 1.0.2ln -s /usr/local/src/phantomjs-1.9.0-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs | |
| ln -s /usr/local/src/n1k0-casperjs-bc0da16/bin/casperjs /usr/local/bin/casperjs | |
| phantomjs --version | |
| casperjs --version |
| /** | |
| * World's simplest express server | |
| * - used to serve index.html from /public | |
| */ | |
| var express = require('express'); | |
| var serveStatic = require('serve-static'); | |
| var app = express(); | |
| app.use(serveStatic(__dirname + '/public')); |
Hi Nicholas,
I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:
The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't
| JIRA on a raspberry pi 2 | |
| Since the raspberry pi 2 comes with 1 GB RAM and a 900 MHz quad-core I wanted to give it a try | |
| if it is capable of running JIRA | |
| Download free trial linux .tar.gz archive from https://www.atlassian.com/software/jira/download?b=j | |
| Untar with tar -zxvf <archive> | |
| Check java version and set JAVA_HOME | |
| Make sure that you have a java version installed that is supported by JIRA |