This file contains 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 "active_support" | |
require "active_support/key_generator" | |
require "json" | |
# Based on https://gist.github.com/mattetti/7624413 | |
module JsonSessionSerializer | |
def self.load(value) | |
begin | |
JSON.parse(value) | |
rescue JSON::ParserError |
This file contains 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
module Views | |
class Rat < SimpleDelegator | |
begin | |
include Decorator | |
rescue NameError => e | |
end | |
def initialize(data) | |
super OpenStruct.new(attributes[data]) | |
end |
Work in progress, I'll write this up properly when I'm done.
Almost all credit goes to @maxogden for putting me on to this and pointing me in the right direction for each of these items.
Prerequisites:
- Raspberry Pi
- Kindle Paperwhite freed from its locked down state (jailbroken) http://www.mobileread.com/forums/showthread.php?t=198446
- You have to downgrade your Kindle to 5.3.1 to install the current jailbreak; that's just a matter of getting the old version image, putting it on your Kindle via USB and telling it to install "upgrade". Then you put in the Jailbreak files, load the ebook and break.
- Your kindle will be quick to detect an upgrade is available so it'll want to upgrade soon afterwards but the jailbreak will last but you have to reinstall the developer certificates so it's a bit of a pain but doable. Find all the instructions on the mobileread.com forums and wiki.
This file contains 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 './injection' | |
require 'pry' | |
class CallTracker < BasicObject | |
attr_reader :tracked_calls | |
def initialize | |
@tracked_calls = ::Hash.new { |h, k| h[k] = 0 } |
This file contains 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
# rbenv install | |
## Assumptions | |
You are using homebrew. | |
## What to install? | |
* https://github.com/sstephenson/rbenv.git |
This file contains 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 | |
# 2011-10-10 20:57:53 +1000 | |
def merge_sort(a) | |
return a if a.size <= 1 | |
l, r = split_array(a) | |
result = combine(merge_sort(l), merge_sort(r)) | |
end |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This file contains 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
# = Icebox : Caching for HTTParty | |
# | |
# Cache responses in HTTParty models [http://github.com/jnunemaker/httparty] | |
# | |
# === Usage | |
# | |
# class Foo | |
# include HTTParty | |
# include HTTParty::Icebox | |
# cache :store => 'file', :timeout => 600, :location => MY_APP_ROOT.join('tmp', 'cache') |
NewerOlder