This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby -w | |
# Find any deleted but not index files in the git status output | |
# and add them to the index using the 'git rm' command | |
# USAGE: gir | |
`git status`.each do |s, flag| | |
flag = true if s.include? '# Changed but not updated:' | |
`git rm #{s.gsub(/#.*deleted:\s*/, '')}` if s.include? 'deleted:' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
# POST /api/v1/:format/new | |
# GET /api/v1/:format/gists/:user | |
# GET /api/v1/:format/:gist_id | |
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'), | |
{ 'files[file1.ab]' => 'CONTNETS', | |
'files[file2.ab]' => 'contents' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -iname "*.php" -path "./controllers/*" -or -path "./models/*" -or -path "./views/*" -or -path "./tests/*" | xargs wc -l | grep 'total' | awk '{print $1}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add xml extensions to all files in the directory | |
# '-I %' switch specifies '%' as a replacement character all instances of '%' | |
# will be replaced with the argument | |
ls -1 | xargs -I % mv % %.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# A quick little ruby script to run in the shell to have your existing | |
# local branch track a remote branch | |
# Ex: git-track add origin master | |
# git-track remove origin master | |
if ARGV.empty? or ARGV.length < 3 | |
puts "USAGE: git-track [add|remove] <remote-name> <branch-name>\n\n" | |
exit | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function slideShow(elem) { | |
return (function () { | |
var next_elem = (elem.next().length > 0) ? elem.next() : $('#slide-images p:first'); | |
elem.fadeOut(1000); | |
next_elem.fadeIn(1000); | |
setTimeout(slideShow(next_elem), 5000); | |
}) | |
} | |
$(document).ready(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rename a bunch of pngs to add leading 0's | |
#!/usr/bin/env ruby | |
`ls -1 *.png`.each_line do |l| | |
`mv #{l.strip} #{l.strip.sub(/_(\d5)(\.|_)/, '_0\1\2')}` if l.match(/_\d5(\.|_)/) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Something to do for the gist command line script: | |
# Add a method that lists all your gists in the same way that git log does it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Ignored .svn directories | |
# Also ignored .DS_Store files from Mac file system | |
# Add the --dry-run argument if you want to just test it first | |
DOMAIN="phototourwebsites@phototourwebsites.com" | |
DIR="/home/phototourwebsites/www/phototoursmls/idx_dev_andrew" | |
rsync -avz \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A rough and dirty baseline Rails app template | |
# I just discovered this feature and love it | |
remove_files = [ | |
"public/index.html", | |
"public/images/rails.png", | |
"public/javascripts/controls.js", | |
"public/javascripts/dragdrop.js", | |
"public/javascripts/effects.js", | |
"public/javascripts/prototype.js" |
OlderNewer