Skip to content

Instantly share code, notes, and snippets.

View noahgrant's full-sized avatar

Noah Grant noahgrant

View GitHub Profile
@noahgrant
noahgrant / backbone.fetch.js
Last active November 8, 2018 16:09 — forked from akre54/backbone.fetch.js
Backbone.ajax with window.fetch
import _ from 'underscore';
import Backbone from 'backbone';
import {stringify} from 'qs';
const backboneSync = Backbone.sync.bind(Backbone);
const MIME_TYPE_JSON = 'application/json';
const MIME_TYPE_DEFAULT = 'application/x-www-form-urlencoded; charset=UTF-8';
Backbone.sync = (method, model, options) => {
@noahgrant
noahgrant / post-merge
Last active August 29, 2015 14:00
a quick script to call bower install and npm install automatically if bower.json or package.json are changed, respectively. this file should be called post-merge and should be placed in /.git/hooks/. it should be executable. **this hook does not get triggered if your git pulls are set to auto rebase.
#!/bin/sh
# noah grant
# quick script to call bower install and npm install automatically if
# bower.json or package.json are changed, respectively.
# add to .git/hooks/
# this assumes one top-level file for each
changedfiles=( `git diff --name-only HEAD@{1}` )
// Gruntfile.js
'use strict';
var path = require('path');
module.exports = function (grunt) {
// Load externally-defined tasks
grunt.loadTasks('tasks/grunt');
@noahgrant
noahgrant / gist:5044155
Created February 27, 2013 01:37
Slightly bigger jsdom example
var http = require('http'),
request = require('request'),
util = require('util'),
jsdom = require('jsdom'),
jquery = require('jquery'),
xhr = require('xmlhttprequest');
exports.test = function(req,res) {
request('http://www.lg.com/us/washers/all-washers', function(err, response, body) {