Skip to content

Instantly share code, notes, and snippets.

View indirect's full-sized avatar

André Arko indirect

View GitHub Profile
#!/bin/sh -x
CURRENT=`git branch | grep "\*" | cut -d' ' -f2`
git checkout master
git svn info >/dev/null 2>/dev/null
if [[ $? == 0 ]]; then
git svn rebase
else
git pull origin master
fi
git checkout ${CURRENT}
#!/usr/bin/env ruby
# The script that give you focus!
# Create a text file that contains sites want to give yourself
# access to only during certain times of day.
#
# The file will look like this:
# 12 news.ycombinator.com
# 11-13,19-21 twitter.com
#
@indirect
indirect / Gemfile
Created February 12, 2010 08:11 — forked from samgranieri/Gemfile
rails 2.3.5 configuration for bundler 0.9.5
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
gem 'sqlite3-ruby', :require => 'sqlite3'
# Devise 1.0.2 is not a valid gem plugin for Rails, so use git until 1.0.3
# gem 'devise', :git => 'git://github.com/plataformatec/devise.git', :ref => 'v1.0'
group :development do
# bundler requires these gems in development
@indirect
indirect / gist:318909
Created March 1, 2010 22:58 — forked from defunkt/gist:307193
Dev-mode ruby
# Instead of this:
# $ ruby -rubygems -I lib bin/thing test
# Run this:
# $ druby thing test
function druby() {
ruby -rubygems -I lib bin/$@
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.engineyard.redis</string>
<key>Program</key>
<string>/usr/local/bin/redis-server</string>
<key>ProgramArguments</key>
<array>
@indirect
indirect / debug_proxy.rb
Created March 23, 2010 22:11 — forked from eventualbuddha/debug_proxy.rb
Debug proxy objects
# ruby -rdebug_proxy -e "DebugProxy.new('foo', :string).gsub!(/o/, 'a')"
#
# DebugProxy (string) -------------------------
# | |
# | Method called on proxy object: |
# | gsub!(/o/, "a") |
# | |
# | Stack trace of method call: |
# | -e:1 |
# | |
@indirect
indirect / mcd.bash
Created April 22, 2010 22:46 — forked from eventualbuddha/mcd.fish
make and then cd to a directory
# make and cd to a directory
function mcd {
mkdir -p $1
cd $1
}
@indirect
indirect / gist:388981
Created May 4, 2010 05:03
ruby hashes like JS objects
class Hash
def method_missing( msg, *args )
super unless args.empty?
if has_key?(msg)
[msg]
elsif has_key?(msg.to_s)
[msg.to_s]
else
nil
end
@indirect
indirect / gist:434208
Created June 11, 2010 07:47 — forked from blaine/gist:428898
Text size based on physical letter size
var setTextMeasure = function (contentElement, targetMeasure, maxSize, minSize) {
if (!contentElement) contentElement = document.createElement('p');
if (!targetMeasure) targetMeasure = 66;
if (!maxSize) maxSize = 16;
if (!minSize) minSize = 9;
var sizer = contentElement.cloneNode();
sizer.style.cssText = 'margin: 0; padding: 0; color: transparent; background-color: transparent; position: absolute;';
@indirect
indirect / uri.js
Created April 22, 2012 03:33 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"