Skip to content

Instantly share code, notes, and snippets.

View garybernhardt's full-sized avatar

Gary Bernhardt garybernhardt

View GitHub Profile
puts "export #{vars.map { |k, v| %{#{k}="#{v}"} }.join(" ")}"
failbowl:rubies(master) $ git l
* 65cc7ef (41 seconds) <Gary Bernhardt> (HEAD, master) Merge branch 'activate_command_cleanup'
|\
| * f4ced72 (2 minutes) <Gary Bernhardt> extract variables
| * f2760be (3 minutes) <Gary Bernhardt> File.join instead of string interpolation
| * 94b8df5 (5 minutes) <Gary Bernhardt> activate command's imperative part is in activate!
|/
* 9291243 (7 minutes) <Gary Bernhardt> Merge branch 'ruby_info_cleanup'
|\
| * b7cb944 (9 minutes) <Gary Bernhardt> indentation
#!/usr/bin/env bash
main() {
if [ ! -p .test-commands ]; then
mkfifo .test-commands
fi
while true; do
cmd=$(cat .test-commands)
if [[ $cmd == "" ]]; then
bench "paths", :without_gc => true, :gc_time => true do
PATHS[0, 1000].each { |choice| Score.score(choice, "x" * 16) }
end
Output:
...!.!.!.!..............................................
filtering paths
Before: | --X----------------------- |
After: | ---------X-------------------------|
it "requires an amount_charged greater than 0" do
order = FactoryGirl.build(:order, :amount_charged => 0)
order.valid?.should == false
order.errors[:amount_charged].should == ["must be greater than 0"]
end
failbowl:selecta(scoring_redesign) $ ruby ../readygo/readygo.rb --compare benchmark.rb
.!.!.!.!.!.!.!.!..!.!.!.!.!.!.!.!.!.!...!.!.!.!.!.!.!.!.............................................................................................................
filtering non-matching
Baseline: | X-----------|
Current: | X--------- |
0 6.848 ms
filtering matching exactly
Baseline: | X-------------------|
require "erb"
require "pathname"
DOT_TEMPLATE=<<-END
digraph {
size="20,20";
overlap=false;
sep=0.4;
graph [fontname=Helvetica,fontsize=10];
node [fontname=Helvetica,fontsize=10];
find $(manpath | tr ':' '\n') -iname '*.1' | xargs cat | (LC_CTYPE=C tr -C '[:alnum:]-_' '\n') | egrep '^--[\-_[:alnum:]]+$' | sort | uniq -c | sort -n
module RenderToHTML
def self.book
[title, css, body].join("\n")
end
private
def self.title
commit_hash = `git log -1 --pretty="format:%H"`
%{
git diff --name-status head~3000..head | grep '^D' | awk '{print $2}' | while read f; do git log -1 --pretty="format:%H" -- "$f"; done > temp.txt