Skip to content

Instantly share code, notes, and snippets.

@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()
@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 / 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: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 / 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:4171749
Created November 29, 2012 20:37
Tag a release and push
git tag release-`date +"%Y%m%d"` && git push origin release-`date +"%Y%m%d"`
@robballou
robballou / closures.js
Created December 17, 2012 15:39
Code from my JavaScript Best Practices from AtenCamp 2012
// closures
(function($, Drupal, drupalSettings) {
var snow_base = 10;
Drupal.behaviors.snowman = {
attach: function() {
// can access $, Drupal, drupalSettings
}
#!/usr/bin/env python
import argparse
import sh
import re
import os
def verbose(message, options={}):
"""Display a message if we are using verbose mode"""
if 'verbose' not in options or not options.verbose:
#!/bin/bash
# create an empty shell module
if [[ $# -ne 1 ]]; then
echo 'Usage: drupal_make_module.sh [module_name]'
exit 1
fi
if [[ ! -d sites/all/modules ]]; then
@robballou
robballou / gist:5302105
Created April 3, 2013 15:15
Work-in-progress of a sublime plugin to fold just functions.
import sublime, sublime_plugin
import re
class FoldFunctionsCommand(sublime_plugin.TextCommand):
def run(self, edit):
# find things marked as a meta.function
functions = self.view.find_by_selector('meta.function.php')
print "FoldFunctions: functions found: %d" % len(functions)
# loop through those functions and figure out what region that they
# take up.