This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
module MyHelpers | |
def foo | |
"#{params[:bar]}" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Main controller for the Tomtelizer | |
# | |
class TomtelizerViewController < UIViewController | |
# Load the view | |
# | |
def loadView | |
self.view = UIImageView.alloc.init | |
@debug_face = false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'time' | |
class SlotLength | |
# Contains the number of seconds in the slot | |
attr_reader :seconds | |
attr_reader :ordered_seconds | |
# Contains the string for the slot length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "save_current_checksums" do | |
it "saves the current checksums to redis" do | |
checksums = { foo: 'bar', baz: 'qux'} | |
REDIS.keys.must_be_empty | |
fingerprint.stub(:field_checksums, checksums) do | |
fingerprint.save_current_checksums | |
REDIS.get('vision:episode:123456:checksum'). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An extremely hackish solution | |
module Sinatra | |
module Templates | |
def yajl_partial(template, locals={}) | |
Yajl::Parser.parse yajl(template, {}, locals) | |
end | |
end | |
end | |
# I’ll add a better solution when I figure something out :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'terminal-notifier' | |
options = {} | |
begin | |
parser = OptionParser.new do |opts| | |
opts.banner = "Usage: terminal-notifier MESSAGE [options]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'minitest/spec' | |
require 'minitest/pride' | |
require 'minitest/autorun' | |
def long(shortcut) | |
case shortcut | |
when 'protos','proto','xorgprotos','xorg1','x1','1' | |
'xorg_protos' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'open-uri' | |
require 'json' | |
screen_name = ARGV[0] | |
if screen_name.nil? | |
puts "ruby twitter_friends_on_alpha.rb twitter_username" | |
exit | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
def adn2rfc(user) | |
abort "You need to specify user on app.net" if user.nil? | |
http = Net::HTTP.new('alpha.app.net', 443) | |
http.use_ssl = true | |
res = http.request_get("/#{user}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'ostruct' | |
require 'json' | |
class GeoipService | |
def initialize(http = nil) | |
@http = http || Net::HTTP.new('freegeoip.net') | |
end | |
def call(host) |