Skip to content

Instantly share code, notes, and snippets.

View thirtysixthspan's full-sized avatar

Derrick Parkhurst thirtysixthspan

View GitHub Profile
Failures:
1) AuditLocationService locations doesn't include reported locations
Failure/Error: expect(audit_location_service.locations(audit.id, options)[0].length)
expected: 2
got: 4
(compared using ==)
# ./spec/coefficient/audit_location_service_spec.rb:243:in `block (3 levels) in <top (required)>'
@thirtysixthspan
thirtysixthspan / streamline_sql_import.rb
Created January 7, 2015 16:12
streamline_sql_import.rb
#!/usr/bin/env ruby
# Streamline (speed up) import of mysql dumps containing very large
# tables with multiple indexes.
#
# Indexes are removed from all table definitions. Indexes are added
# after all inserts are completed.
#
# usage:
# cat DUMPFILE | ./streamline_sql_import.rb | mysql -uroot DATABASE
#
// Github
// https://github.com/temochka/sublime-text-2-github-tools
{ "keys": ["control+g", "g"], "command": "public_gist_from_selection" },
{ "keys": ["control+g", "p"], "command": "private_gist_from_selection" },
{ "keys": ["control+g", "u"], "command": "open_gist_url" },
{ "keys": ["control+g", "o"], "command": "open_gist_in_editor" },
@thirtysixthspan
thirtysixthspan / gist:74c9b312f7992b1e8d47
Created December 29, 2014 18:15
Sublime Gist Keybindings
// Github Gists
// https://github.com/condemil/Gist
{ "keys": ["control+g", "g"], "command": "gist" },
{ "keys": ["control+g", "p"], "command": "gist_private" },
{ "keys": ["control+g", "u"], "command": "gist_update_file" },
{ "keys": ["control+g", "l"], "command": "gist_list" },
{ "keys": ["control+g", "i"], "command": "insert_gist_list" },
{ "keys": ["control+g", "a"], "command": "gist_add_file" },
@thirtysixthspan
thirtysixthspan / gist:7f61e799b70ac36fd212
Created September 27, 2014 21:46
who_wrote_this_code
function who_wrote_this_code { find $1 \( ! -regex '.*/\..*' \) -name '*.rb' -type f -print -exec git blame '{}' \; | ruby -pe "sub /(^.*\((.*?)\s+2.*$)/, '\2'" | egrep -vE '[[:punct:][:digit:]]' | sort | uniq -c | sort -nr; }
@thirtysixthspan
thirtysixthspan / file_slice.rb
Created November 30, 2012 06:33
When you need a File object but only want part of the file accessible, there is FileSlice
class FileSlice < File
def limit(lower,upper)
@lower = lower
@upper = upper
@offset = @lower
rewind
end
def rewind
@thirtysixthspan
thirtysixthspan / DDANSI.PAS
Created July 28, 2012 17:48
What I believe is my first open source code contribution..... from DoorDriver 4.0
{--- Circa 1989 ---}
unit ddansi;
interface
uses dos, crt;
{----------------------------------------------------------------------------}
{ Ansi screen emulation routines }
{ By Scott Baker }
@thirtysixthspan
thirtysixthspan / sparse_sim_frost.rb
Created February 10, 2012 04:38
Sparse Sim Frost
class Particle
attr :x
attr :y
attr :state
def initialize(field, values = {})
@field = field
@state = values[:state] || '.'
@next_state = @state
@x = values[:x] || rand(@field.size)
@thirtysixthspan
thirtysixthspan / update.rb
Created December 9, 2011 03:36
The Gilded Rose Code Kata - a 'solution'
def update_quality(items)
rules = { "Conjured" => { ds:-1, mq:50, dq:[ -4, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2 ]},
"Sulfuras" => { ds: 0, mq:80, dq:[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]},
"Aged Brie" => { ds:-1, mq:50, dq:[ +2, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1 ]},
"Backstage" => { ds:-1, mq:50, dq:[-50, +3, +3, +3, +3, +3, +2, +2, +2, +2, +2, +1 ]},
"." => { ds:-1, mq:50, dq:[ -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ]}}
items.each do |item|
rules.each do |key,rule|
if item.name=~/#{key}/
item.quality += rule[:dq][ [0, item.sell_in, 11].sort[1] ]
<p> with amazonPaymentsAccounId </p>
<form method="post" action="https://authorize.payments-sandbox.amazon.com/pba/paypipeline">
<input type="hidden" value="11SEM03K88SD016FS1G2" name="accessKey">
<input type="hidden" value="315.0" name="amount">
<input type="hidden" value="Invoice #1 from Opus Video Productions" name="description">
<input type="hidden" value="EwhxireJt/0G1keEvy773ldIdOWB4EyIPkJOXbzeyvk=" name="signature">
<input type="hidden" value="HmacSHA256" name="signatureMethod">
<input type="hidden" value="2" name="signatureVersion">
<input type="hidden" value="EMZXSGCRFEZL3DGZ625KKGGQBTDPJ26F6ZCNQ3" name="amazonPaymentsAccountId">
<input type="hidden" value="http://0.0.0.0:3000/payment_cancelled" name="abandonUrl">