Skip to content

Instantly share code, notes, and snippets.

View reubano's full-sized avatar

Reuben Cummings reubano

View GitHub Profile
@tbranyen
tbranyen / server.js
Last active July 4, 2021 18:44
backbone/node.js pushState enabled server
// Require libraries
var os = require("os");
var fs = require("fs");
var readline = require("readline");
var cluster = require("cluster");
var express = require("express");
var site = express();
// Var up, bro
var i, read;
@spulec
spulec / pre-commit
Last active January 13, 2023 02:26
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^[MA]\s+(?P<name>.*)$')
CHECKS = [
@linus
linus / Publish a message
Created January 4, 2012 15:54
Server-side Events with Node.js and Redis
linus@Newton:~$ redis-cli
redis 127.0.0.1:6379> publish /updates.foo "hello there!"
(integer) 1
redis 127.0.0.1:6379>
@domenic
domenic / 1flickrApi.js
Last active April 4, 2018 07:35
Flickr API experiments
"use strict";
// Uses jQuery and Q.
var API_KEY = "whatever";
function getFlickrResponseAsync(method, responseProperty, params) {
var deferred = Q.defer();
$.ajax("http://www.flickr.com/services/rest/", {
@ggaughan
ggaughan / pipeloadYQL.py
Created June 2, 2012 12:54
Initial YQL pipe loader mechanism
"""Pipe finders and loaders
Use these to import Yahoo! pipes as Python modules with support for nested imports
(C) Greg Gaughan, 2012
"""
"""Example usage (see __main__ below for a dynamic version):
import sys
@ksafranski
ksafranski / Common-Currency.json
Last active April 22, 2024 15:16
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@lost-theory
lost-theory / gist:3005268
Created June 27, 2012 16:35
consume JSON REST API blueprint inside flask app
from flask import Flask, jsonify, Blueprint, current_app
import json
## REST api ###################################################################
api = Blueprint('api', __name__)
@api.route("/users")
def users():
return jsonify(users=[
@milosdakic
milosdakic / stream.js
Created August 13, 2012 03:27
Backbone.js Collection/Model Stream mixin
/**
* Stream collection/model data.
* @exports mixins/Stream
* @module Stream
*/
var Stream = {
/**
* Is the collection steaming?
*
* @property streaming
@nickpoorman
nickpoorman / app.coffee
Created August 20, 2012 10:33
Express.js Backbone.js pushState router
# if the resource is not found then forward to backbone's router
app.use (req, res) ->
newUrl = req.protocol + '://' + req.get('Host') + '/#' + req.url
res.redirect newUrl
@jpennell
jpennell / fabfile.py
Created September 18, 2012 01:15
Fabric fabfile for Django/Heroku App
from fabric.api import env, local, require
def deploy():
"""fab [environment] deploy"""
require('environment')
maintenance_on()
push()
syncdb()
migrate()