Skip to content

Instantly share code, notes, and snippets.

View mdb's full-sized avatar

Mike Ball mdb

View GitHub Profile
@mdb
mdb / gist:2569902
Created May 1, 2012 17:36
Vim FTL Syntax
" Vim syntax file
" Language: FreeMarker Template Language (FTL)
" Maintainer: Stephan Müller <[email protected]>
" Last Change: 2008 Oct 22
syn case match
" directives and interpolations
syn region ftlStartDirective start=+<#+ end=+>+ contains=ftlKeyword, ftlDirective, ftlString, ftlComment
syn region ftlEndDirective start=+</#+ end=+>+ contains=ftlDirective
@mdb
mdb / gist:3150594
Created July 20, 2012 12:56
tests/author.js
var assert = require("assert");
var request = require("request");
describe('auther', function () {
var auther = require("../auther");
it('exists', function () {
it('should not be null', function () {
assert.notEqual(auther, null);
@mdb
mdb / gist:3150598
Created July 20, 2012 12:57
tests/author.js
var assert = require("assert");
var request = require("request");
describe('auther', function () {
var auther = require("../auther");
it('exists', function () {
it('should not be null', function () {
assert.notEqual(auther, null);
$ mocha tests/auther.js
fs.js:400
return binding.readdir(pathModule._makeLong(path));
^
Error: ENOTDIR, not a directory 'tests/auther.js'
at Object.readdirSync (fs.js:400:18)
at lookupFiles (/usr/local/lib/node_modules/mocha/bin/_mocha:396:6)
at /usr/local/lib/node_modules/mocha/bin/_mocha:241:24
at Array.forEach (native)
module.exports = function(app) {
app.get('/', function(req, res){
console.log(__dirname)
res.render('index', {
title: '2012 PollWatcher'
});
});
app.get('/:state', function(req, res){
console.log(__dirname)
var placeholderElems = $('[data-test]');
var placeholderAttr = 'data-test';
var placeholderClass = 'placeholder';
placeholderElems.focus(function() {
var input = $(this);
if (input.val() === input.attr(placeholderAttr)) {
input.val('');
input.removeClass(placeholderClass);
url: http://phlapi.com:5984/v1//phl_bike_network/all
params: {}
response.headers: { server: 'CouchDB/1.0.2 (Erlang OTP/R14B)',
date: 'Thu, 04 Oct 2012 19:51:50 GMT',
'content-type': 'text/plain;charset=utf-8',
'content-length': '1938',
'cache-control': 'must-revalidate' }
{ error: 'render_error',
reason: 'function raised error: (new TypeError("req.headers.Accept is undefined", "", 11)) \nstacktrac
e: ([object Object],[object Object])@:11\nrunList(function (head, req) {var row, out, sep = "\\n";if (re
@mdb
mdb / gist:4206372
Created December 4, 2012 17:11
How to properly version bump a Node.js module
npm version patch -m "Version %s"
git push
git push --tags
npm publish
@mdb
mdb / gist:4288296
Last active October 25, 2022 12:17
How to Amend a Commit
# View the log to find the commit you want to edit:
git log
# Quit out of the log
q
# Rebase from the commit you want to edit, in interactive mode:
git rebase SOME_COMMIT_ID^ --interactive
# This will open an interactive menu in Vi
var DirectoryView = Backbone.View.extend({
el: $("#recordings"),
initialize: function () {
this.collection = new Directory(contacts);
this.render();
},
render: function () {
var that = this;