I hereby claim:
- I am bbwharris on github.
- I am bbwharris (https://keybase.io/bbwharris) on keybase.
- I have a public key ASCIBkyKOykAjy2rFKN8Mm7nL2VidkFrWTutGAZoH-GhLQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
require 'formula' | |
class Stud < Formula | |
url 'https://github.com/bumptech/stud/tarball/a9b5aca962219ef013afaa73fec4676bb7c056a3' | |
version '0.3-a9b5aca962' | |
homepage 'https://github.com/bumptech/stud' | |
sha256 '448ab2d87dd69dd7db8f5c994c55b692a8748e4228865b0be5af1df41c17ca51' | |
depends_on 'libev' | |
#depends_on 'openssl' |
# Not the fastest, but working | |
def longest_palindrome(input_string) | |
# default to the first letter, so we return 'a' palindrome if none found | |
palindrome = input_string.first | |
max = input_string.size | |
# Windows over possible substrings and tests for a palindrome | |
max.downto(0) do |last| | |
0.upto(max) do |first| | |
substring = input_string.slice(first..last) |
# Doubt 100% accurate answer, but seems somewhat correct. | |
TRANSLATOR = { | |
1000 => 'M', | |
900 => 'CM', | |
500 => 'D', | |
400 => 'CD', | |
100 => 'C', | |
90 => 'XC', | |
50 => 'L', |
namespace :states do | |
desc "load state names and abbreviations" | |
task :load => :environment do | |
states = { | |
"Alabama" => "AL", | |
"Alaska" => "AK", | |
"Arizona" => "AZ", | |
"Arkansas" => "AR", | |
"California" => "CA", | |
"Colorado" => "CO", |
# There is more than one way to skin a cat, different coders prefer different methods. | |
include ActionView::Helpers | |
class Link < Struct.new(:title, :url); end | |
a = Link.new("Google", "http://www.google.com") | |
b = Link.new("Hacker News", "http://news.ycombinator.com") | |
array_of_links = [a, b] |
Given delayed jobs are run # step_definitions/common_steps.rb:1 | |
--- | |
- !ruby/object:Delayed::Backend::ActiveRecord::Job | |
attributes: | |
id: 1 | |
priority: 0 | |
attempts: 1 | |
handler: |+ | |
--- !ruby/struct:Delayed::PerformableMethod | |
object: !ruby/object:Page |
require 'digest/sha1' | |
class Anagram | |
attr :anagrams | |
def initialize(file) | |
@anagrams = {} | |
File.open(file).each do |word| | |
add_word_to_anagrams_hash(build_key(word.chomp),word.chomp) | |
end |
@mixin linked_image($image,$width,$height,$xoffset,$yoffset) { | |
background: url($image) no-repeat $xoffset $yoffset; | |
display: block; | |
width: $width; | |
height: $height; | |
text-indent: -9999px; | |
overflow: hidden; | |
} | |
@mixin italic_stack { | |
font-style: italic; |
module ActiveRecord | |
class Base | |
# FROM http://www.xcombinator.com/2008/08/11/activerecord-from_xml-and-from_json-part-2/ | |
def self.from_hash( hash ) | |
h = hash.dup | |
h.each do |key,value| | |
h[key].map! { |e| reflect_on_association(key.to_sym ).klass.from_hash e } if value.is_a?(Array) | |
h[key] = reflect_on_association(key.to_sym).klass.from_hash(value) if value.is_a?(Hash) | |
end |