Skip to content

Instantly share code, notes, and snippets.

joeybaker / On
Created May 22, 2015
Notes on an intro to using npm
View On

On npm

Three "types" of modules

cli modules

  • "bin" in package.json
  • keeping index.js and bin/module separate. You want both programmatic and cli access
  • use yargs to parse options from the CLI. You can do this manually, but it's painful and error prone. yargs also helps you build a good UI.
  • make sure to set the "main" field

browser modules

View flux

Flux research


  • es6 friendly – this means no mixins
  • immutable friendly
  • no promises, because debugging them sucks


  • es6 friendly
View react
View A weekend with

A Weekend With React

I spent Saturday doing another dive into React 0.12 and ES6. I just wanted to share some of the experience since it's a stack that we're strongly considering adopting (for at least some) of our future work.

Once you get past the weirdness of writing HTML in your JS, it's actually really nice to control your template so directly. Part of it maybe that I'm learning ES6 syntax at the same time, but I'm no longer weirded out by JSX. I'm using the 6to5ify browserify transform, so nearly the full spectrum of ES6 is available, and it feels great. Highlights are destructing and the class syntax (I was surprised!). This is legit code:

  // named fuction for free! Don't even need to use the function keyword!
  , getInitialState(){
    var deadline = moment([2015, 8, 6])
View gist:d12e9466afd8b2e8db93
On Thu, Jan 29, 2015 at 9:45 AM, <> wrote:
I recently updated to your new snippet, but it violates the Content Security Protocol settings I have in place because it uses `eval`. It there anyway to opt-out of a script that uses `eval`?
On 29 January, 2015 at 12:08:25 PM, John Clover ( wrote:
Hey Joey
View result.html
<body><main><h1>hi</h1><img width="500" src=""><input><p>graf</p></input></img></main></body>
joeybaker /
Last active Jan 16, 2017
plist file to restart SystemUIServer to work around mavericks silliness
curl -o ~/Library/LaunchAgents/restart_systemuiserver.plist \
&& launchctl load ~/Library/LaunchAgents/restart_systemuiserver.plist
joeybaker /
Created Sep 24, 2014
see if any processes are running bash using dtrace
dtrace -n 'proc:::exec-success/basename(execname)=="bash"/{printf("%d executed %s\n", ppid, execname);}'
View biggest pain
  • npm all the things! It sucks when packages aren't browserify-able.
  • functional/integration tests are incredibly painful to write, run, and maintain.
  • even client side unit tests are hard to debug.
  • I know dev tools are working hard on being an editor, but I wish there was better integration between dev tools and my editor. Editors are hard, dev tools should let the apps that do it well, manage the problem.
  • I wish there was a way to "live reload" js in a hot-swap kinda way.
  • JS errors tend to suck. Async stack traces are a huge win, but some errors are always inscrutable: undefined is not a function