Skip to content

Instantly share code, notes, and snippets.

@bengourley
bengourley / Usage
Created November 11, 2012 13:27
Application level build script
$ node build
// And maybe use an options parser, eg: https://github.com/substack/node-optimist
// to configure piler through `piler.set('key', val)` options through cli:
$ node build --watch
$ node build --env development
var fs = require('fs')
, join = require('path').join
fs.watch(join(process.env.HOME, '.npmrc'), function () {
console.log('touched')
})
fs.utimes(join(process.env.HOME, '.npmrc'), new Date(), new Date())
@bengourley
bengourley / scripts.html
Created December 13, 2012 11:37
Outline of which scripts to load.
<!--
The global bundle is
required on all pages
-->
<script src="global-bundle.min.js"></script>
<!--
Include specific page-related
bundles here:
@bengourley
bengourley / emitter.js
Last active December 11, 2015 11:29
Logger boilerplate, where does it go?
var Emitter = require('events').EventEmitter
function task(options, cb) {
var emitter = new Emitter()
emitter.emit('log', 'Starting stuff', 'info')
emitter.emit('log', 'Fine grained detail about stuff', 'debug')
cb(null)
return emitter
@bengourley
bengourley / image.js
Last active December 15, 2015 10:19 — forked from serby/image.js
{ '2:3':
{ w: 2000
, h: 3000
, x1: 0
, y1: 0
, x2: 200
, y2 300
}
}
/* global slate */
slate.config('defaultToCurrentScreen', true)
slate.config('windowHintsShowIcons', true)
slate.config('windowHintsIgnoreHiddenWindows', false)
var hint = slate.operation('hint')
slate.bind('esc:ctrl', hint)
var fullScreen = slate.operation('push', { direction: 'top', style: 'bar-resize:screenSizeY' })
@bengourley
bengourley / index.js
Created April 23, 2014 15:38
requirebin sketch
var thesaurus = require('thesaurus')
var words = 'Short tutorial on how to write like Russell Brand:\n\n1. Write an article\n2. Replace every word with a synonym from thesaurus.com'.split(' ')
console.log(words.map(function (word) {
var synonyms = thesaurus(word)
if (!synonyms.length) return word
return synonyms[0]
}).join(' '))
@bengourley
bengourley / dependencies.txt
Created May 7, 2014 16:54
List of dependencies from a recent Clock project
async
backbone
brfs
browjadify
browserify
bunyan
bytes
cf-api
cf-auth-middleware
cf-auth-provider
@bengourley
bengourley / index.js
Last active August 29, 2015 14:10
requirebin sketch
var moment = require('moment')
, View = require('ventnor')
, months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
, days = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ]
function DatePickerView() {
View.apply(this, arguments)
this.startYear = 1960
this.endYear = 2030
this.currentView = { month: 11, year: 2014 }
//
// ANYTIME DATE/TIME PICKER
// =============
//
//
// -- Essential styles --
// These styles are the bare minimum to have a working date/time picker.
// These are copied and converted to stylus from
// https://github.com/bengourley/anytime/blob/master/anytime.css