Skip to content

Instantly share code, notes, and snippets.

View JackDanger's full-sized avatar

Jack Danger JackDanger

View GitHub Profile
@JackDanger
JackDanger / git-remove-history.sh
Created August 19, 2010 22:06
remove large binary files from git history
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
#
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
#
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# vi is good
setw -g mode-keys vi
set-option -g default-terminal screen-256color
// A javascript DOM application framework API that just feels right.
// TODO: please build this into an actual framework for me. KTHXBYE.
App('chat', function(selection){
// anything you want to run at
// initialization you can add here
selection.click(function(){
#!/usr/bin/env ruby
require 'pp'
DIR = File.expand_path(__dir__)
module Deprecations
extend self
PATTERN = /DEPRECATION WARNING: (?<message>.*) \(called from (?<source_method>.+) at (?<source_file>[\w\.\/]+):(?<source_line>\d+)/
#!/bin/bash
#
# This script works on OS X with Homebrew Given a specific MySQL version this
# script will ensure that version is installed, nothing incompatible is
# blocking it from working, and the mysqld process responds to queries.
#
mysql_version=$1
if [[ -z "${mysql_version}" ]]; then
echo "USAGE: ${0} MYSQL_VERSION_THAT_HOMEBREW_RECOGNIZES"
echo "example: ${0} mysql@5.5"
function listDocs() {
var folderid = '{any folder id}';
var folder = DriveApp.getFolderById(folderid)
var contents = folder.getFiles();
var file;
var files = [];
while(contents.hasNext()) {
@JackDanger
JackDanger / whereami.py
Created May 20, 2017 06:35
Pry's `whereami` implemented for IPython
def whereami():
import traceback
for stack_frame in traceback.extract_stack():
if stack_frame[3] == 'from IPython.terminal.embed import embed; embed()':
line = stack_frame[1]
file = stack_frame[0]
break
if not line:
raise Exception("couldn't figure out the line number")
@JackDanger
JackDanger / simple_ruby_profile.rb
Last active August 2, 2016 18:05
Fast way to profile a Ruby program
# In your code, right at the top of any source code file.
trap 'PROF' do
File.open("/tmp/profile-#{Time.current.to_f}", 'w') {|f| f.write caller(2).join("\n") }
pid = $$
Thread.new { sleep 0.5; `kill -PROF #{pid}` }
end
# in a terminal
while true; do
sleep 0.1
module Injectable
class Placeholder
def initialize(target)
@target = target
end
def injected_value
@target.generate
end
end
# Square Software Engineer, Foundation Server
Behind the teams that build new features for our millions of merchants there is
a group that builds tools and services to make the product teams' work easier.
We work in every software language and at every layer in the technology stack – from
client to api to server to database. Our mission is to serve the engineers of Square
and, by extension, all the small business owners who need a simple and powerful
payment system. You don't have to know these languages or technologies but you do
need to be willing to learn.