I hereby claim:
- I am nicolashery on github.
- I am nicolashery (https://keybase.io/nicolashery) on keybase.
- I have a public key whose fingerprint is 852A E7B2 14A7 7B4A 4A49 27D3 FA69 6E9C F40A DF41
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// - rendering library (like React) should be able to "pick up" where server | |
// left off (i.e. hook up to the existing HTML) | |
// server.js | |
var server = express(); | |
server.use(function(req, res) { | |
var appHtml = React.renderToString(<App />); | |
var html = injectIntoHtml({app: appHtml}); | |
res.send(html); |
// Exploring using "expose React component tree as data" @swannodette | |
// (https://www.youtube.com/watch?v=5hGHdETNteE#t=1559) | |
// for routing and fetching data ("react-router-mega-demo" @ryanflorence) | |
// (https://github.com/rackt/react-router-mega-demo/blob/master/app/utils/fetchData.js) | |
var appState = { | |
route: '/contacts', | |
contacts: [], | |
messages: [] | |
}; |
// Playing around with TypeScript | |
// Inspiration: https://github.com/abdullin/omni | |
// core.event | |
interface DomainEventType { | |
name: string; | |
} | |
interface DomainEvent { | |
_type: DomainEventType; |
var gulp = require('gulp'); | |
var react = require('gulp-react'); | |
var jshint = require('gulp-jshint'); | |
var cache = require('gulp-cached'); | |
var jsFiles = [ | |
'src/**/*.js', | |
'test/**/*.js', | |
'*.js' | |
]; |
This shows a way to have "environment variables" working for both the webpack-dev-server (local development) and the Divshot server (to test a build locally).
Problem:
.env.json
file in the project directory, and uses it to serve a __/env.js
file__/env.js
file ourselvesA solution:
var merge = require('react/lib/merge'); | |
var m = require('mori'); | |
var toArray = function (val) { | |
if (!Array.isArray(val)) { | |
val = [val]; | |
} | |
return val; | |
}; |
// https://github.com/jlongster/js-csp | |
// Throttle ported from: | |
// https://gist.github.com/swannodette/5886048 | |
var csp = require('js-csp'); | |
var chan = csp.chan; | |
var go = csp.go; | |
var put = csp.put; | |
var take = csp.take; | |
var timeout = csp.timeout; |
DEPRECATED: See https://gist.github.com/nicolashery/9414d2357258718891e3
Pressing "space" a bunch of times, I expect main
to receive only one "key" message on the spaceCh
, but it receives 2?
dist: | |
browserify \ | |
--external lodash \ | |
--external moment \ | |
--require ./index.js:robot \ | |
> bundle.js | |
cat umd-head.js bundle.js umd-tail.js > robot.js |