Skip to content

Instantly share code, notes, and snippets.

View beaumartinez's full-sized avatar
😂
I don't use GitHub

Beau beaumartinez

😂
I don't use GitHub
View GitHub Profile
@igniteflow
igniteflow / prepare-commit-msg
Last active December 29, 2015 16:09
Python prepare-commit-msg to insert [touch:ticket number] to every commit message. Note it adds it commented in order to abort gracefully, otherwise exiting the EDITOR would cause the commit to be actioned as [touch:ticket number] would be recognised as the message. Note that get_ticket_number() logic is custom. Change to extract the ticket numb…
#!/usr/bin/env python
"""
To enable save as /yourproject/.git/hooks/prepare-commit-msg
and make executable: chmod +rx prepare-commit-msg
"""
import sys
from subprocess import check_output
def get_ticket_number():
@zedshaw
zedshaw / gist:6969554
Created October 14, 2013 01:49
Wrapper for a django handler that adds the CORS stuff.
from functools import wraps
from urlparse import urlparse
def cors(func):
def add_basic_headers(resp, url):
resp['Access-Control-Allow-Origin'] = url.scheme + "://" + url.netloc
resp['Access-Control-Allow-Credentials'] = 'true'
resp['Access-Control-Allow-Methods'] = 'GET'
resp['Access-Control-Allow-Headers'] = 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'
@robfletcher
robfletcher / _safe-rgba.scss
Created May 17, 2013 08:45
SASS mixin that uses modernizr to output fallback color property for browsers that don't support RGBA.
/*
* Outputs a color property with an opaque fallback for browsers that do not support RGBA.
*/
@mixin safe-rgba($property, $color, $fallback-color: opacify($color, 1)) {
@if opacity($color) == 1 {
#{$property}: $color;
} @else {
#{$property}: $fallback-color;
.rgba & {
#{$property}: $color;
# you can make a text file of request times (in ms, one number per line) and import it here, or you can use a probability distribution to simulate request times (see below where setting req_durations_in_ms)
# rq = read.table("~/Downloads/request_times.txt", header=FALSE)$V1
# argument notes:
# parallel_router_count is only relevant if router_mode is set to "intelligent"
# choice_of_two, power_of_two, and unicorn_workers_per_dyno are only relevant if router_mode is set to "naive"
# you can only select one of choice_of_two, power_of_two, and unicorn_workers_per_dyno
run_simulation = function(router_mode = "naive",
reqs_per_minute = 9000,
@leemartin
leemartin / sprites.coffee
Created January 25, 2013 17:33
WebRTC Sprites Generator
$ ->
# Variables
photo = 0
size = 150
directions =
center: { x: size, y: size, i: "straight ahead" }
north: { x: size, y: 0, i: "up" }
northwest: { x: 0, y: 0, i: "up over your right shoulder" }
west: { x: 0, y: size, i: "right" }
southwest: { x: 0, y: size * 2, i: "at your right shoulder" }
@mpiche
mpiche / gist:3906919
Created October 17, 2012 17:34 — forked from mharju/gist:3805082
Unknown pleasures album cover visualization for Processing. This is the version in http://www.youtube.com/watch?v=nYOh_laT4_Q
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer player;
AudioInput input;
FFT fft;
@robinsloan
robinsloan / langoliers.rb
Last active April 7, 2024 13:22
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen