Skip to content

Instantly share code, notes, and snippets.

Stephen Murray spmurrayzzz

Block or report user

Report or block spmurrayzzz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
spmurrayzzz / immutable-proxy-example.js
Last active Oct 22, 2016
Immutable object factory, using proxies
View immutable-proxy-example.js
const immutable = require('./immutable');
let obj;
obj = immutable({ foo: 'bar' }); = 'baz'; // assignment fails silently
delete; // delete fails silently
obj = immutable({ foo: [ 1, 2, 3 ] }); 4 ); // mutation fails silently
spmurrayzzz / score.js
Created Aug 16, 2015
js13kgames closure fun
View score.js
(function() {
var score = 0;
Object.defineProperty( this, 'score', {
get: function(){
return score;
set: function( val ) {
score = val;
this.elem.innerHTML = _.template(
tmplStr, { score: score }
View localStorage-shim.js
// Sourced from
// Note: The maximum size of data that can be saved is severely restricted by the use of cookies.
// With this algorithm, use the functions localStorage.setItem() and localStorage.removeItem() to add,
// change, or remove a key. The use of methods localStorage.yourKey = yourValue; and delete localStorage.yourKey;
// to set or delete a key is not a secure way with this code. You can also change its name and use it only to
// manage a document's cookies regardless of the localStorage object.
if (!window.localStorage) {
Object.defineProperty(window, "localStorage", new (function () {
spmurrayzzz / Vagrantfile
Last active Dec 31, 2015
High-performing Vagrant settings
View Vagrantfile
# Note: If you're serving files via shared folders, for christs sake use NFS
# but that does require private networking.
# The DNS settings were the ones that made the most difference, so if you're resource
# constrained, the last two settings were the ones that helped the most.
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]
vb.customize ["modifyvm", :id, "--cpus", 2]
spmurrayzzz / d_day.js
Created Jul 10, 2013
fucking birthday
View d_day.js
var me = new Person();
var d_day = setInterval(function(){
if (me.age == 30) {
console.log('fuck my life');
}, 86400e1);
spmurrayzzz /
Last active Dec 17, 2015
Semi-intelligently archive the contents of Mac OS X Desktop
#!/usr/bin/env python
Quick and dirty script that moves desktop clutter to a date-sorted archive
location. Nothing elegant here, just keeps desktop workspace much less
cluttered. Intended to be run as a cron job at a sane frequency.
Usage is ideal if your desktop is merely a swap space, not so ideal if your
spmurrayzzz /
Created Apr 18, 2013
Scrape donors from HTML
#!/usr/bin/env python
from subprocess import call
from bs4 import BeautifulSoup
import json
import os
def get_html():
if os.path.isfile('richard-family-fund'):
spmurrayzzz /
Created Mar 24, 2013
Project Euler #25
def fib():
first = 0
second = 1
while True:
cached = first
first = first + second
second = cached
yield first
spmurrayzzz /
Created Feb 20, 2013
Extending Django User model
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
# ------------- USERS -------------
class UserProfile(models.Model):
user = models.OneToOneField(User)
def __unicode__(self):
You can’t perform that action at this time.