Skip to content

Instantly share code, notes, and snippets.

View underhilllabs's full-sized avatar

Bart Lantz underhilllabs

View GitHub Profile
@jfexyz
jfexyz / .profile
Created March 10, 2011 18:44
Git Bash tools: Bash completion and shell prompt to list current branch/dirty status. Add this code to your .profile or .bash_profile or .bashrc.
##
# Bash completion scripts
##
if type brew > /dev/null 2>&1 && [ -f `brew --prefix`/etc/bash_completion ]; then
# Homebrew: http://mxcl.github.com/homebrew/
. `brew --prefix`/etc/bash_completion
fi
if [ -f /contrib/completion/git-completion.bash ]; then
@jfexyz
jfexyz / .gitconfig
Created March 10, 2011 18:43
Git Config: Rename this file ".gitconfig" and place inside your home directory.
##
# This file should be renamed ".gitconfig" and placed inside your home directory.
##
[user]
name = YOUR_NAME
email = YOUR_EMAIL
[github]
user = YOUR_GITHUB_USERNAME
token = YOUR_GITHUB_TOKEN
@jfexyz
jfexyz / gist:864614
Created March 10, 2011 18:38
Git(Hub) Drupal Project Development Model

Setup

Configure git by using the template for .gitconfig, and adding commands for a Git-aware prompt to .profile.

To clone the repository (the "template" parameter is important):
git clone [email protected]:user/repo.git --template=/PATH/TO/TEMPLATES

Also run (this will set up the repository so a branch can be pushed only while on that branch):
git config remote.origin.push HEAD

@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@knitfaced
knitfaced / RavelryClientSignin.java
Created November 1, 2010 21:46
snippet to connect to the Ravelry API
private String createShopSearchQuery() throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
String jsonAction = "http://api.ravelry.com/shops/search.json?";
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ");
Calendar now = Calendar.getInstance();
String timestamp = df.format(now.getTime());
String searchTerm = "yarn";
int shop_type_id = 1;
String query = jsonAction;
query += "access_key=" + urlEncode(ACCESS_KEY);
@josegonzalez
josegonzalez / category.rb
Created August 14, 2010 21:41
Category plugin for Jekyll
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')