View clean-branches.bash
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
ruby bin/clean-branches.rb $* >/dev/null 2>/dev/null && git for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/heads |
View default.js
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
// since they do it on non-posterous domains, I put this in ~/.js/default.js | |
// (using, of course, github.com/defunkt/dotjs) | |
$().ready(function() { | |
if ($('meta[content="Posterous"]')) { | |
$("<style type='text/css'>a#posterous_footerbar{ display: none }</style>").appendTo("head"); | |
} | |
}); | |
// thnx to @voodootikigod for the meta check - skips unnecessary DOM manipulation delays |
View personal git punch card grapher
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
# usage: ruby timecard.rb path branch name-of-graph-file-not-including-extension | |
# e.g.: ruby timecard.rb . master timecard #=> produces timecard.png | |
require 'rubygems' | |
# This requires the 'cyberfox-gchart' gem (0.5.4), as the standard | |
# gchart gem is woefully broken for this kind of graph. Broken to the | |
# point that it's an inherent design choice that doesn't work well for | |
# this kind of chart. I'm sure that the cyberfox-gchart gem won't |
View migration.rb
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
# this monkey-patches code defined in railties-3.1.0.rc1/lib/rails/generators/migration.rb | |
# (obviously, this might differ very slightly in the latest release candidate) | |
module Rails | |
module Generators | |
module Migration | |
module ClassMethods | |
# differs from the "real" version by only one line | |
def migration_template(source, destination=nil, config={}) | |
destination = File.expand_path(destination || source, self.destination_root) |
View tab-title.bash
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 this() { # obtain git branch | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
# https://superuser.com/a/599156 | |
function tab-title { | |
echo -ne "\033]0;"$*"\007" | |
} |
View giles_prompt.bash
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 giles_prompt { | |
tab-title $(this) | |
# display git user name for pairing via git pair | |
# "this" function returns git branch name | |
export PS1="\[\033[0;95m\]<\u (\$(git config user.name))> \[\033[0;96m\]\w\[\033[0m\]\[\033[0;32m\] \$(this)\[\033[0m\]\n\[\033[0;34m\] $(unicode_nonsense)\[\033[0m\] " | |
} | |
export PROMPT_COMMAND=giles_prompt |
View unicode_nonsense.bash
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 unicode_nonsense { | |
if [ $? -eq 0 ] | |
then echo "\[\033[0;32m\]ᕕ(ᐛ)ᕗ" | |
else echo "\[\033[0;31m\]¯\_(ツ)_/¯" | |
fi | |
} |
View heroku_style_baby.rb
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 'rubygems' | |
require 'sinatra' | |
require 'json' | |
class GitHubUpdater | |
def self.update?(json) | |
(JSON.parse(json)["ref"] == "refs/heads/master") | |
end |
View にほんご.rb
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
# This file should contain all the record creation needed to seed the database with its default values. | |
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). | |
# | |
# Examples: | |
# | |
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) | |
# Character.create(name: 'Luke', movie: movies.first) | |
# FIXME: only a few flash cards have forms or parts of speech, enough to get the idea going. |
View d-gen.clj
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
(asdf) | |
(defn- state-line [[state results]] | |
(let [d (->> results | |
(sort-by :year) | |
(reduce (fn [line {:keys [year from-center]}] | |
(conj line (str (x-for-margin from-center) | |
"," | |
(+ 10 (year-base year))))) |
NewerOlder