Skip to content

Instantly share code, notes, and snippets.

View JoeyButler's full-sized avatar

Joey B JoeyButler

  • The Vagabond Programmer
  • A city near you
View GitHub Profile
@mattetti
mattetti / rails_encryptor_reduction.rb
Last active December 29, 2015 16:28
Quick high level rundown showing how Rails 4 sets the message encryptor used for sessions, signed messages and more.
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
@mattetti
mattetti / foo.rb
Last active December 16, 2015 10:59
o_O
module Views
class Rat < SimpleDelegator
begin
include Decorator
rescue NameError => e
end
def initialize(data)
super OpenStruct.new(attributes[data])
end
@rvagg
rvagg / README.md
Last active May 4, 2024 12:17
Kindleberry "Paperwhite" Pi

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.
@ernie
ernie / call_tracker.rb
Created September 23, 2012 19:57
Injection.rb
#!/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 }
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@revans
revans / gist:1348811
Created November 8, 2011 19:19
rbenv install
# rbenv install
## Assumptions
You are using homebrew.
## What to install?
* https://github.com/sstephenson/rbenv.git
@nkpart
nkpart / merge_sort.rb
Created October 14, 2011 04:04 — forked from kimhunter/merge_sort.rb
Merge sort ruby
#!/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
@jasonrudolph
jasonrudolph / about.md
Last active May 14, 2024 16:36
Programming Achievements: How to Level Up as a Developer
@karmi
karmi / httparty_icebox.rb
Created October 13, 2009 20:20
Cache 200 OK responses in HTTParty models
# = 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')