Skip to content

Instantly share code, notes, and snippets.

function Animal(genus, species) {
var animal = Object.create(Animal.prototype);
animal.genus = genus;
animal.species = species;
return animal;
}
function Dog(species) {
var dog = Object.create(Dog.prototype);
@rhocairn
rhocairn / client.js
Created May 11, 2015 18:07
server.js
var http = require('http');
var requestDataString = '';
var requestOptions = {
hostname: "127.0.0.1",
port: 8888,
path: "/",
method: "GET"
};
var req = http.request(requestOptions, function(res) {
@rhocairn
rhocairn / do_stuff.js
Last active August 29, 2015 14:22
Basic EventEmitter example
var SimpleQueue = require('./simple_queue');
// Set up our SimpleQueue instance
var queue = SimpleQueue();
queue.on(SimpleQueue.events.JobAdded, function(job) {
console.log("A job was added:", job);
});
queue.on(SimpleQueue.events.NoJobs, function() {
console.log("Someone wanted to get a job, but none were in the queue");
});

Keybase proof

I hereby claim:

  • I am rhocairn on github.
  • I am gmaybrun (https://keybase.io/gmaybrun) on keybase.
  • I have a public key ASApECVGhhCeThsEm7hJJvF2ntJpptP48Hs7Hiq4Awk28wo

To claim this, I am signing this object: