Skip to content

Instantly share code, notes, and snippets.

var config = require('./config');
var _ = require('underscore');
var url = require('url');
require('backbone').ajax = function(options) {
var deferred = require('q').defer();
_.extend(options, {
json : true,
url : url.resolve(config.API_URL, options.url)
var _ = require('underscore');
var Backbone = require('backbone');
var cheerio = require('cheerio');
var request = require('request');
Backbone.ajax = function(options) {
options.json = true;
return request(options, function(error, result) {
if (error) {
@nhunzaker
nhunzaker / SassMeister-input.scss
Created March 10, 2014 14:31
Generated by SassMeister.com.
// ----
// Sass (v3.3.0)
// Compass (v1.0.0.alpha.18)
// ----
@import "compass";
body {
@include background-image(linear-gradient(rgba(#000, 0.03), rgba(#000, 0.3)));
}
@nhunzaker
nhunzaker / 0_reuse_code.js
Created February 7, 2014 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
;;; bash.el -- Sets some key bindings for shell-script-mode
;;; Commentary:
;;; Code:
(defun current-buffer-to-string ()
"Get the contents of the current buffer as a string."
(interactive)
(buffer-substring (point-min) (point-max)))
(defun shell-script-mode-eval-buffer()
@nhunzaker
nhunzaker / gist:6262330
Last active December 21, 2015 06:09 — forked from anonymous/gist:6262325
exports.searchContactPost = function(req, res) {
if (req.body.searchContacts === '') { res.send('Oops you searching for nothing, well here is nothing!'); };
async.waterfall([
function(callback) {
var contact = req.body.searchContacts.toLowerCase()
User.find({$or:[
{firstName: contact },
{lastName : contact },
@nhunzaker
nhunzaker / Makefile
Last active February 7, 2019 04:13
Access LMU light sensor on Mac. Also includes the Emacs plugin I use for automatically updating my theme according to ambient light.
all:
gcc light.m -std=c99 -framework Foundation -framework IOKit -o light
clean:
rm -f light
@nhunzaker
nhunzaker / Gemfile
Created January 25, 2013 21:51
No JavaScript Tracking
source 'https://rubygems.org'
gem 'sinatra'
@nhunzaker
nhunzaker / app.js
Last active December 10, 2015 23:59
var express = require('express');
var app = express();
var port = process.env.PORT || 9292;
app.get('/', function(req, res) {
res.render('index');
});
app.post('/control/:action', function(req, res) {
@nhunzaker
nhunzaker / python_question_1.md
Last active December 10, 2015 22:59
The first question I'm making for a list of python exercises!

Python Question 1

Problem: I need a program that can add stuff together.

First, add integers together:

$ python add.py 1 2 3 4 5
15