Skip to content

Instantly share code, notes, and snippets.

View drewdeponte's full-sized avatar

Drew De Ponte drewdeponte

View GitHub Profile
@drewdeponte
drewdeponte / git-cwd-info.rb
Created January 31, 2012 23:06
git-cwd-info.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# Emits Git metadata for use in a Zsh prompt.
#
# AUTHOR:
# Ben Hoskings
# https://github.com/benhoskings/dot-files/blob/master/files/bin/git_cwd_info
#
# MODIFIED:
import sublime, sublime_plugin, subprocess
class GuardCommand(sublime_plugin.WindowCommand):
def run(self):
guard_output_view = self.window.get_output_panel('guard')
self.window.run_command('show_panel', {'panel': 'output.guard'})
p = subprocess.Popen(['/Users/adeponte/bin/wrap_guard'], shell=True)
cur_line = p.stdout.readline
while (cur_line != ""):
Started PUT "/tasks/reorder.js" for 127.0.0.1 at 2012-01-22 19:26:34 -0800
Processing by TasksController#reorder as JS
Parameters: {"serialized_tasks"=>"task[]=2&task[]=12&task[]=11&task[]=3&task[]=1&task[]=6&task[]=9&task[]=10&task[]=8&task[]=7&task[]=14&task[]=4&task[]=5&task[]=13&task[]=15&task[]=16&task[]=17&task[]=18&task[]=19&task[]=20&task[]=21&task[]=22&task[]=23&task[]=24&task[]=25&task[]=26&task[]=27&task[]=28&task[]=29&task[]=30&task[]=31&task[]=32&task[]=33&task[]=34&task[]=35&task[]=36&task[]=37&task[]=38&task[]=39&task[]=40&task[]=41&task[]=42&task[]=43&task[]=44&task[]=45&task[]=46&task[]=47&task[]=48&task[]=49&task[]=50&task[]=51&task[]=52&task[]=53&task[]=54&task[]=55&task[]=56&task[]=57&task[]=58&task[]=59&task[]=60&task[]=61&task[]=62&task[]=63&task[]=64&task[]=65&task[]=66&task[]=67&task[]=68&task[]=69&task[]=70&task[]=71&task[]=72&task[]=73&task[]=74&task[]=75&task[]=76&task[]=77&task[]=78&task[]=79&task[]=80&task[]=81&task[]=82&task[]=83&task[]=84&task[]=85&task[]=86&task[]=87&task[]=8
@drewdeponte
drewdeponte / gist:1649290
Created January 20, 2012 20:02
git-current-branch
#!/bin/sh
# Print the current Git branch.
#
# AUTHOR:
# Geoffrey Grosenbach http://peepcode.com
git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||'
@drewdeponte
drewdeponte / gist:1643455
Created January 19, 2012 22:42
my .gitconfig in my home directory
[user]
name = Andrew De Ponte
email = [email protected]
[color]
ui = auto
[alias]
st = status
ci = commit
@drewdeponte
drewdeponte / zshrc
Created January 16, 2012 17:37
my zshrc
# DESCRIPTION:
# A simple zsh configuration that gives you 90% of the useful features that I use everyday.
#
# AUTHOR:
# Geoffrey Grosenbach http://peepcode.com
export PATH="/Users/adeponte/bin:$PATH"
# RVM
if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi
@drewdeponte
drewdeponte / .zshrc
Created January 12, 2012 22:49
gco and gco-
alias gco="export DREW_LAST_G_BRANCH=\`git branch | grep -E '\* \w+' | awk '{ print \$2 }'\`; echo \$DREW_LAST_G_BRANCH; git checkout"
alias gco-="export DREW_LAST_G_BRANCH_TMP=\$DREW_LAST_G_BRANCH; gco \$DREW_LAST_G_BRANCH_TMP"
@drewdeponte
drewdeponte / generatable_regexp.rb
Created January 9, 2012 03:57
generate_from_segments
def generate_from_segments(segments, params, merged, options, optional = false)
if optional
return EMPTY_STRING if segments.all? { |s| s.is_a?(String) }
return EMPTY_STRING unless segments.flatten.any? { |s|
params.has_key?(s.name) if s.is_a?(DynamicSegment)
}
return EMPTY_STRING if segments.any? { |segment|
if segment.is_a?(DynamicSegment)
value = merged[segment.name] || @defaults[segment.name]
value = parameterize(segment.name, value, options)
@drewdeponte
drewdeponte / route.rb
Created January 9, 2012 03:26
rack-mount route generate
def generate(method, params = {}, recall = {}, options = {})
puts "DREW: method: #{method}"
puts "DREW: params: #{params.inspect}"
puts "DREW: recall: #{recall.inspect}"
puts "DREW: options: #{options.inspect}"
if method.nil?
result = Hash[@conditions.map { |m, condition|
[m, condition.generate(params, recall, options)] if condition.respond_to?(:generate)
}]
return nil if result.values.compact.empty?
/home/rpi/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find passenger (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/rpi/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/rpi/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /home/rpi/bin/passenger-install-apache2-module:18:in `<main>'