Skip to content

Instantly share code, notes, and snippets.

@joeybaker
joeybaker / On npm.md
Created May 22, 2015 00:31
Notes on an intro to using npm

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

Flux research

desires

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

fluxible

http://fluxible.io/faq.html

  • es6 friendly

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])
On Thu, Jan 29, 2015 at 9:45 AM, <joey@byjoeybaker.com> wrote:
Hello–
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 (john@heapanalytics.com) wrote:
Hey Joey
@joeybaker
joeybaker / result.html
Created January 18, 2015 18:55
vdom err example
<body><main><h1>hi</h1><img width="500" src="http://cat.jpg.to"><input><p>graf</p></input></img></main></body>
@joeybaker
joeybaker / install.sh
Last active January 16, 2017 16:41
plist file to restart SystemUIServer to work around mavericks silliness
curl -o ~/Library/LaunchAgents/restart_systemuiserver.plist https://gist.githubusercontent.com/joeybaker/1d32226d928d05a95860/raw/483d41b06427f524b5df0c4d224fb0e2e8ba14e9/restart_systemuiserver.plist \
&& launchctl load ~/Library/LaunchAgents/restart_systemuiserver.plist
@joeybaker
joeybaker / usesBash.sh
Created September 24, 2014 21:21
see if any processes are running bash using dtrace
dtrace -n 'proc:::exec-success/basename(execname)=="bash"/{printf("%d executed %s\n", ppid, execname);}'
  • 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