Skip to content

Instantly share code, notes, and snippets.

View BaseCase's full-sized avatar

Casey Brant BaseCase

  • Madison, WI
View GitHub Profile
@BaseCase
BaseCase / HOWTO-interactive_rebase.md
Last active September 3, 2016 15:08
How to squash branches with interactive rebase

How to Squash Git Branches with Interactive Rebase

In this tutorial, we'll learn how to convert a git branch from many commits into a single commit before merging it. There's one key command to learn: git rebase -i

Prerequisites

Let's assume that you have a branch, feature/foo, that was branched off of develop. The git log might look something like this:

* baec937 (HEAD -> feature/foo) remove TODO comment
* 4fb174d add spec for foo model
* bb84984 update the foo serializers
@BaseCase
BaseCase / movie_time.py
Last active August 29, 2015 14:07
uses OMDB to grab running times for a list of movie titles
# Requires the 'requests' lib to be installed in your python path
# usage: `python movie_time.py "title 1" "title 2" "title 3" (etc.)`
# OR: `python movie_time.py -f filename` # file format should be newline separated list of titles
#
# output is a list of run times for each movie plus the total
# it will return 0 for the runtime of a movie it can't find
import sys
import requests
@BaseCase
BaseCase / add_property.js
Last active August 29, 2015 13:57
Makes it super easy to convert `foo.bar` and `foo.bar = baz` into method calls instead of property lookups!
function add_property(prop_name, default_value) {
var getter = this['get_' + prop_name] || default_getter(prop_name);
var setter = this['set_' + prop_name] || default_setter(prop_name);
Object.defineProperty(this, prop_name, {
get: getter.bind(this),
set: setter.bind(this),
enumerable: true
});
@BaseCase
BaseCase / duplicate_labels.py
Last active December 12, 2015 02:39
This script will take the labels from one GitHub repository's Issues and sync all of your other repos' Issues with them. After running, all of your repos will have the exact same set of Issues labels. It assumes that every repo has Issues enabled.
#!/usr/bin/python
#
# This script will take the labels from one GitHub repository's
# Issues and sync all of your other repos' Issues with them. After
# running, all of your repos will have the exact same set of Issue
# labels. It assumes that every repo has Issues enabled.
#
# REQUIREMENTS: needs the 'requests' library, available from pip
#
# Config variables: