Skip to content

Instantly share code, notes, and snippets.

View h-lame's full-sized avatar
💀
a momentary diversion on the road to the grave

Murray Steele h-lame

💀
a momentary diversion on the road to the grave
View GitHub Profile
@h-lame
h-lame / rename_model.rb
Created June 6, 2012 08:40
Model rename refactor script. (From @threedaymonk)
#!/usr/bin/env ruby
class Renamer
attr_reader :from, :to
def initialize(from, to)
@from = from
@to = to
end
module TicketProcessing
class TicketHTMLGenerator
def initialize(ticket)
@ticket = ticket
end
def generate!
renderer.render(context)
end
@h-lame
h-lame / featured_topics_and_policies.js
Created April 10, 2013 11:45
Cope with the fact that what we clone: a) has chosen selects in it that don't like being cloned - we remove their chosen artifacts and re-chosen()-ify them b) has hidden chosen selects in it that don't re-render properly if they were hidden - we do the same thing that we do on initial load and wait for all of them to declare they are ready befor…
@h-lame
h-lame / .hgrc
Created December 3, 2013 19:22
My hgrc, with these plugins and options I basically replicated a close to git workflow.
[ui]
verbose = True
merge = diffmerge
[pager]
pager = LESS='FSRX' less
[extensions]
pager =
color =
module Scoring
def self.included(base)
base.class_eval do
let(:__score_keeper) { ScoreKeeper.new }
extend ScoreHelpers
include ScoreMatchers
end
end
class ScoreKeeper
<html>
<head>
<style>
pre.terminal {
display: block;
background-color: black;
color: white;
font-family: monospace;
height: 480px;
width: 640px;

Keybase proof

I hereby claim:

  • I am h-lame on github.
  • I am hlame (https://keybase.io/hlame) on keybase.
  • I have a public key whose fingerprint is 39B4 6B57 2042 0DED F0F4 8D1C 770E BCE3 52EA C8EA

To claim this, I am signing this object:

@h-lame
h-lame / bwt.rb
Last active August 29, 2015 14:05
Implementation of a Burrows-Wheeler Transform, as guided by https://github.com/zetter/burrows-wheeler-transform
class BWT
def encode(string)
chars = "#{string}$".chars
rotations = []
chars.length.times.
inject(chars) do |new_chars, _|
rotations << new_chars
new_chars.rotate
end
@h-lame
h-lame / after.rb
Created February 20, 2015 10:42
Refactoring?
def find_previous_table_for(element)
find_previous_sibling_of_type(element, 'table')
end
def find_previous_sibling_of_type(element, element_type_to_find)
previous_siblings(element).find do |previous_element|
previous_element.node_name == element_type_to_find
end
end
@h-lame
h-lame / gist:8fb54e83aa514bb78f77
Last active August 29, 2015 14:19
*OFFER CLOSED* [LRUG] [GIVEAWAY] Copies of "The Well Grounded Rubyist (2nd Edition)" to give away
From: Murray Steele <[email protected]>
To: London Ruby Users Group <[email protected]>
Subject: [LRUG] [GIVEAWAY] Copies of "The Well Grounded Rubyist (2nd Edition)" to give away
Hi all,
As announced at the start of the meeting on Monday the nice folks at
Infinitium Global have decided to give a little back to the community in
some way. One thing they were keen for is that they were giving back to
the community in a way that would help it grow and encourage folk just