May 18, 2013

Module Driven in node.js

I was inspired by the talk that Thorsten Lorenz gave at NodePDX yesterday, and I've been making an effort to take his advice.

Even using pkginit, it was still annoying to have to create the same old .gitignore file, and duplicate portions of the package.json in the README.md.

That's why I created module-driven. I encourage you to give it a try. Here's what a run-through looks like using my template:

$ npm install -g module-driven

$ moduleDriven easy-peasie
description: Get going, fast!

$ find easy-peasie
easy-peasie
easy-peasie/.gitignore
easy-peasie/package.json
easy-peasie/README.md
easy-peasie/test

$ cat easy-peasie/package.json
{
  "name": "easy-peasie",
  "description": "Get going, fast!",
  "version": "0.0.1",
  "repository": {
    "url": "git://github.com/curious-attempt-bunny/easy-peasie.git"
  },
  "main": "index.js",
  "scripts": {
    "test": "tap test/*.js"
  },
  "dependencies": {
  },
  "devDependencies": {
    "tap": "~0.4.3",
    "tape": "~1.0.2"
  }
}


By way of explanation here's the contents of my ~/.content/module-driven folder:


$ cat ~/.config/module-driven/package.json.mdtmpl 
{
  "name": "{{name}}",
  "description": "{{description}}",
  "version": "0.0.1",
  "repository": {
    "url": "git://github.com/curious-attempt-bunny/{{name}}.git"
  },
  "main": "index.js",
  "scripts": {
    "test": "tap test/*.js"
  },
  "dependencies": {
  },
  "devDependencies": {
    "tap": "~0.4.3",
    "tape": "~1.0.2"
  }
}

May 17, 2013

nodepdx 2013: Building a Multiplayer World for Pillow Pets

[Lanyrd notes] Charlie sketched out their approach to implementing Pillow Pets World.

nodepdx 2013: minecraft.js

[Lanyrd notes] Max is the author of voxeljs and the free online book The Art of Node. For peer-to-peer communication in the browser, check out peer.js.


2013 nodepdx: Module Driven Development

[Lanyrd notes] This was a fantastic talk. Thorsten made a compelling case for aggressively factoring your apps into modules:

  • Everything in your lib folder is a candidate for a node module. Publish it!
  • Every module is a function (module.exports = function (..) { .. })!
  • Hoogle is the inspirations for a library of functions
  • Put each function in a separate file (it makes coupling code harder)
  • Include tests and demonstrate that it works now (travis / testling)
  • replpad
  • Use npm init of pkginit
  • travisify
  • npm link

May 16, 2013

Quadcopter hacking in node.js with ar-drone and opencv

Here's a video of an AR Drone controlled by my node.js code: On the bottom left of the video you can see my computer screen with the video stream from the quadcopter. I had it set up to use opencv and the cv.FACE_CASCASE object detection, so it actually turned towards you. Fun stuff!

nodepdx 2013: Introducing NodeSecurity.io

[Lanyrd notes] Adam presents the Node Security Project which aims to find and fix security problems in npm modules.

nodepdx 2013: Programming with a Purpose

[Lanyrd notes] Jason challenged us to be selective about what we put our effort into - "we make systems, our systems effect the real world, we are the scarcity, we have as much power as we can recognize [to build the kind of world we want to live in]"

nodepdx 2013: Thursday Lightning Talks


  1. Passport - express middleware for OpenID authentication.
  2. Scoping rules in JavaScript
  3. Scaling yourself "being busy is a form of laziness [i.e. indiscriminate action]", "don't put energy into things you don't want more of"

nodepdx 2013: An Introduction to Functional Reactive Programming

[Lanyrd notes] Chris described Functional Reactive Programming, and walked through examples in  Flapjax and bacon.js. Other options are ClojureScript, Shafty, Javelin, and Elm.

nodepdx 2013: Implementing Git in JavaScript & the Browser: A Case Study

[Lanyrd notes] Chris walked through the internals of git. He recommends:

  • Write lots of small modules (easier to test, write, document, and change)
  • Use browserify (great build tool, great for shimming, great toolings - source maps, beefy, testling ci)
  • Put APIs in terms of streams (pluggable API, don't need the entire thing working to test, don't need all of the data at once to process)