Skip to content

Instantly share code, notes, and snippets.

@robballou
robballou / gist:4025722
Created November 6, 2012 16:11
Current Bash prompt stylings
# ---------------------------------------------------------------------
# colorize the prompt
# ---------------------------------------------------------------------
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/'
}
GREEN_BOLD="\[\e[32;1;32m\]"
CLEAR="\[\e[m\]"
YELLOW="\[\033[0;33m\]"
export PS1="\u:$GREEN_BOLD\W$CLEAR$YELLOW\$(parse_git_branch)$CLEAR \$ "
@robballou
robballou / gist:3955133
Created October 25, 2012 20:15
.gitconfig aliases
[alias]
d = diff
st = status -sb
co = checkout
ci = commit
br = branch
ps = !"git pull && git st"
l = log --name-status --abbrev-commit
ls = git log --name-status --abbrev-commit --pretty="%n%Cgreen%h%Creset | %cd | %Cblue%an%Creset"
p = push
@robballou
robballou / rakefile.rb
Created September 7, 2012 15:13
Compress rakefile
# =====================================================================
# File definitions
# =====================================================================
js = [
{
:target => "target.js",
:minify => true,
:files => [
"source1.js",
"source2.js",
@robballou
robballou / gist:3558264
Created August 31, 2012 20:09
Add this to ignore class instances (things like Date and other general JS classes) in the symbols list
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List Banned Class Instance</string>
<key>scope</key>
<string>source.js meta.class.instance</string>
<key>settings</key>
<dict>
@robballou
robballou / gist:3442080
Created August 23, 2012 21:29
Work on transering file(s) to Glacier
#!/usr/bin/env python
import argparse
import tempfile
import os
from boto.s3.connection import S3Connection
parser = argparse.ArgumentParser(description='description')
parser.add_argument('bucket')
args = parser.parse_args()
(function($){
$(document).ready(function(){ });
})(jQuery);
(function($){
$(document).ready(function(){
$('.section-header').each(function(){
var $this = $(this);
// use .add() and .nextUntil() to get both the .section-header
// and .section-item elements into a single set for our .wrapAll() call
$this.add($this.nextUntil('.section-header', '.section-item'))
.wrapAll('<div class="section-container"></div>');
<div class="container">
<div class="section-header"><h3>Header</h3></div>
<div class="section-item">...</div>
<div class="section-item">...</div>
<div class="section-item">...</div>
<div class="section-header"><h3>Header</h3></div>
<div class="section-item">...</div>
<div class="section-item">...</div>
@robballou
robballou / gist:3189989
Created July 27, 2012 19:23
Re-attaching Drupal behaviors to an element
// remove the ajax-processed class from the element so that
// attachBehaviors() will update the element
$('#my-element-id').removeClass('ajax-processed');
// now re-attach the behaviors to this element
Drupal.attachBehaviors($('#my-element-id'));
@robballou
robballou / workTime.py
Created June 20, 2012 21:47
Calculate the hours from the start of the work day
#!/usr/bin/env python
"""
workTime.py
Coded by: Rob Ballou ([email protected])
Calculates the number of hours that have passed
in a work day (starting at 8:30).
The start time can be changed by passing the hour and min