Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cmwright on github.
  • I am cmwright (https://keybase.io/cmwright) on keybase.
  • I have a public key ASCldeeV_jagzhTeflcR44iejorShufPmWAEhVsl4hGFqgo

To claim this, I am signing this object:

# this requires git-completion (`brew install git bash-completion`)
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
@cmwright
cmwright / filter_menu.html
Last active August 29, 2015 14:02
Backbone FilterMenu POC
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone-localstorage.js/1.1.7/backbone.localStorage-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.10.2/typeahead.bundle.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.marionette/1.8.6/backbone.marionette.min.js"></script>
<script type='text/javascript'>
_.templateSettings = {
@cmwright
cmwright / json_dump_benchmark.rb
Created May 18, 2014 14:50
Benchmarking json vs oj with multiple oj modes
require 'json'
require 'oj'
require 'benchmark'
require 'securerandom'
h = {}
10_000.times{|i| h[SecureRandom.uuid] = i}
Benchmark.bmbm do |x|
x.report("json") { 1000.times{ n = h.to_json} }
@cmwright
cmwright / gist:8443668
Created January 15, 2014 20:15
Searching for s3 keys
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import sys
conn = S3Connection('ACCESS_KEY_ID', 'SECRET_ACCESS_KEY')
bucket = conn.get_bucket('BUCKET')
rs = bucket.list('FOLDER')
file_search = "FILE_NAME"
@cmwright
cmwright / post-receive
Created June 25, 2013 14:47
Basic git post receive. This file belongs in `{RAILS_ROOT}/.git/hooks`. It needs to be given executable permission (`chmod +x {RAILS_ROOT}/.git/hooks/.post-receive`). Anything written to STDOUT or STDIN will be written back to the user pushing.
#!/bin/bash -l
echo "Starting redeploy of youtube-pusher-staging"
cd /vidyard/VidyardDashboard
unset GIT_DIR
git checkout -f
echo "Bundling..."
bundle install
function psych_boot {
sed 's/syck/psych/' /vidyard/VidyardDashboard/config/boot.rb > /vidyard/VidyardDashboard/config/better_boot.rb
mv /vidyard/VidyardDashboard/config/better_boot.rb /vidyard/VidyardDashboard/config/boot.rb
}
function syck_boot {
sed 's/psych/syck/' /vidyard/VidyardDashboard/config/boot.rb > /vidyard/VidyardDashboard/config/better_boot.rb
mv /vidyard/VidyardDashboard/config/better_boot.rb /vidyard/VidyardDashboard/config/boot.rb
}
{
"auto_indent": true,
"color_scheme": "Packages/User/Sunburst (SL).tmTheme",
"drag_text": false,
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"font_size": 12.0,
"ignored_packages":
[
"Vintage"
// install the run_multiple_commands plugin from https://gist.github.com/nilium/3327730
[
{"keys": ["ctrl+="], "command": "insert", "args": {"characters": " => "}},
{"keys": ["ctrl+p"], "command": "insert_snippet", "args": {"contents": "params[:$0]"}},
{"keys": ["ctrl+;"], "command": "run_multiple", "args": {"commands": [
{ "command": "move_to", "args": {"to": "eol"} },
{ "command": "insert", "args": {"characters": ";"} }
]}},
{"keys": ["super+shift+v"], "command": "paste" },
{"keys": ["super+v"], "command": "paste_and_indent"},
<?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>author</key>
<string>Stanley Rost</string>
<key>comment</key>
<string>(π) Soryu, 2005</string>
<key>name</key>
<string>Sunburst</string>