Skip to content

Instantly share code, notes, and snippets.

View jdhuntington's full-sized avatar
🏎️
-><-

JD Huntington jdhuntington

🏎️
-><-
View GitHub Profile
#!/usr/bin/env ruby
# 2008.10.03
# JD Huntington
# Darell Fuhriman
# shell script to assist in working with lighthouse and git
#
# requires lighthouse api ruby wrapper and git library
# $ gem sources -a http://gems.github.com/
# $ gem install Caged-lighthouse-api
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
require 'digest/md5'
BASE_URL = 'http://www.instapaper.com'
LOGIN_URL = 'http://www.instapaper.com/user/login'
USERNAME = ARGV.first
token: fedcba9876543210aabbccddeeff112233445566 # Token from lighthouse
account: mycompany # part of http://mycompany.projectdx.com/projects/1234-project-name/
status: fixed # status tickets should have when they're fixed
project: 1234 # part of http://mycompany.projectdx.com/projects/1234-project-name/
$ bugflow start 123
# now working on branch 'bf123-fix-a-serious-bug'
{ ... do some work ... }
$ git add <files>
$ bugflow fixed "Commit message here" # Or just 'bugflow fixed' to edit message in EDITOR
# committed revision abcdef "Commit message here [#123 state:verify assign:none]"
{ ... merge branch and push ... }
#!/usr/bin/env ruby
# Add books from http://sivers.org/book to a couch db
# todo - parse author out of 'title' field
require 'rubygems'
require 'couchrest'
require 'nokogiri'
require 'open-uri'
require 'clip'
import Data.List
triangulate x = x * ( 1 + x ) / 2
pentagulate x = x * ( 3 * x - 1 ) / 2
hexagulate x = x * ( 2 * x - 1 )
triangles = [ triangulate x | x <- [1..] ]
pentagons = [ pentagulate x | x <- [1..] ]
memberOfIncreasingSequence x = (==x).head.dropWhile(<x)
@jdhuntington
jdhuntington / each_or_inject.rb
Created February 15, 2011 19:00
Testing whether or not Enumerable#inject works well with a Hash.
require 'rubygems'
require 'ruby-prof'
require 'digest/md5'
$x = (1..100_000).to_a.map { |x| Digest::MD5.hexdigest(x.to_s) }
abort "Usage: #{__FILE__} (time|allocations) (inject|each)" if ARGV.length != 2
if ARGV[0] == 'time'
RubyProf.measure_mode = RubyProf::PROCESS_TIME
@jdhuntington
jdhuntington / gist:1847126
Created February 16, 2012 19:22
PDX Lunch
@jdhuntington
jdhuntington / _form.rb
Created February 24, 2012 16:48 — forked from mpattee/_form.rb
Unexpected lack of validation
<ul>
<li><%= f.label :name %>: <%= f.text_field :name %></li>
<li><%= f.label :url %>: <%= f.text_field :url, :size => 100 %></li>
<li><%= f.label :slot %>: <%= f.select :equipmentSlot, @slots %></li>
<li><%= f.label :weight %>: <%= f.text_field :weight %></li>
<li><%= f.label :price %>: <%= f.text_field :price %></li>
<li><%= f.label :rarity %>: <%= f.text_field :rarity %></li>
<li><%= f.label :speed %>: <%= f.text_field :speed %></li>
<li><%= f.label :armor_type %>: <%= f.text_field :armorType %></li>
<li><%= f.label :armor_check %>: <%= f.text_field :armorCheck %></li>
@jdhuntington
jdhuntington / watch-markdown-in-browser.rb
Created October 26, 2012 22:04
Preview markdown in browser
#!/usr/bin/env ruby
require 'tempfile'
require 'rubygems'
require 'kramdown'
abort "Usage: #{__FILE__} <target file path>" unless ARGV[0]
TARGET_FILE = File.expand_path(ARGV[0])