Skip to content

Instantly share code, notes, and snippets.

@jmreidy
jmreidy / gist:1401332
Created November 28, 2011 18:03 — forked from GraemeF/gist:1401254
vows-bdd
{Feature} = require "vows-bdd"
vows = require 'vows'
assert = require 'assert'
Feature("Share stuff between steps", module)
.scenario("Set properties on given and when")
.given "A is set", ->
@A = "A"
ctx = this
@jmreidy
jmreidy / env.sample.js
Created December 28, 2011 23:28
Pivotal to Sprintly importer
module.exports = {
pivotal: {
TOKEN: 'TOKEN'
PID: 'PID',
},
sprintly: {
USER: "USER_EMAIL",
ID: 'PRODUCT_ID',
KEY: 'API_KEY'
},
@jmreidy
jmreidy / app.coffee
Created January 20, 2012 16:08
Backbone.js Loading notification
activeRequests = []
Backbone._sync = Backbone.sync
Backbone.sync = (method, model, options) ->
asyncToken = Backbone._sync.apply(this,arguments)
asyncToken.then () ->
activeRequests = _.without activeRequests, asyncToken
if activeRequests.length == 0 then console.log "LOADING COMPLETE"
if activeRequests.length == 0
console.log "START LOADING"
The first context
Creating Person with name Nick
✗ Errored » callback not fired
in Create a Person via JavaScript: When a person has a name,
in Creating a Person
in undefined✗ Errored » 1 errored ∙ 1 dropped
@jmreidy
jmreidy / gist:3000395
Created June 27, 2012 00:13
Callbacks vs Promises
#callbacks
async.parallel([
(done) ->
Post.findAll((err, posts) ->
done(err, posts)
)
(done) ->
Category.findAll((err, docs) ->
done(err, docs)
)

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

"use strict";
// Domenic needs a Tweeter
function Domenic(tweeter) {
this.tweeter = tweeter;
}
Domenic.inject = ["tweeter"];
Domenic.prototype.doSomethingCool = function () {
return this.tweeter.tweet("Did something cool!");
@jmreidy
jmreidy / 1-index.js
Created June 19, 2013 15:59
A quick browserify rundown
//assume that Backbone and $ are available as globals
//everything in this file will be interpretted as soon as the JS is
//loaded by the browser.
var MainRouter = require('./2-mainRouter'); //A Backbone Router
//doc ready
$(function () {
router = new MainRouter();
@jmreidy
jmreidy / todoApp.jsx
Last active January 4, 2016 01:59
modularizing jsx. Makes use of [grunt-browserify](https://github.com/jmreidy/grunt-browserify) with [reactify](https://github.com/andreypopp/reactify) for compiling JSX as a transform.
var TodoItem = require('../templates/todoItem.jsx');
//in render fn...
var todoItems = mori.into_array(mori.map(function (todo) {
idx++;
return TodoItem.call(this, todo, idx);
}.bind(this), shownTodos));
'use strict';
suite('Edit account', function() {
test('Change name', function(done) {
var self = this;
this.browser
.get(e2eConfig.baseUrl + "/user/edit")
.waitForElementByCss('form', self.mochaOptions.timeout);
.then(function (form) {