Skip to content

Instantly share code, notes, and snippets.

View laserlemon's full-sized avatar

Steve Richert laserlemon

View GitHub Profile
@laserlemon
laserlemon / magic.rb
Created May 3, 2012 20:38
"Patient" Evaluation
class MagicProxy
@methods = []
def self.method_missing(method)
@methods << method
# Put magic here!
puts @methods.join('.')
self
end
end
@laserlemon
laserlemon / authlogic.rb
Created September 26, 2011 16:09
Cucumber ♡ Authlogic
require "authlogic/test_case"
World(Authlogic::TestCase)
Before do
@cookies = ActionDispatch::Cookies::CookieJar.new(Rails.application.config.secret_token)
Authlogic::TestCase::MockCookieJar.stub(:new).and_return{ @cookies }
ActionDispatch::Request.any_instance.stub(:cookies).and_return{ @cookies }
ActionDispatch::Request.any_instance.stub(:cookie_jar).and_return{ @cookies }
71.205.214.254 - - [19/Jul/2011:00:01:43 +0000] "GET /buttons/OV5a-bMRyaFfCUMiElKvCA.png HTTP/1.1" 404 313 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30"
Feature: Chat
As a user
I want to chat with other users
So I feel like part of a community
@javascript
Scenario: Push for chat
Given the following users exist:
| name |
| Steve |
@laserlemon
laserlemon / yajl_encoding.rb
Created May 26, 2011 20:40
YAJL encoding initializer
[NilClass, TrueClass, FalseClass].each do |klass|
klass.class_eval do
def as_json(options = nil)
self
end
end
end
ActiveSupport::JSON::Encoding::Encoder.class_eval do
def encode(value, use_options = true)
source "http://rubygems.org"
gem "rails", "3.0.7"
gem "pg"
gem "jquery-rails", "~> 1.0.7"
gem "faye", "~> 0.6.0"
group :development, :test do
# Initialize new Triple DES, CBC cipher with PKCS5 padding
cipher = Cipher.new
# Begin
cipher.encrypt
# Pass in encryption key, as given: "...rbtrj"
cipher.key = "KEY"
# Pass in initialization vector, as given: "...gdf="
@laserlemon
laserlemon / BONSMODL.BAS
Created December 28, 2010 13:55
Refactoring of BOUNCE.BAS
SCREEN 12: CLS : xs = 1: ys = 1: x = 25: y = 25
1 CIRCLE (xx, yy), 20, 0: CIRCLE (x, y), 20, 15
DO: s = s + 1: IF s = 30 THEN s = 0: EXIT DO
LOOP: xx = x: yy = y: x = x + xs: y = y + ys
IF x < 25 OR x > 615 THEN xs = -xs
IF y < 25 OR y > 455 THEN ys = -ys
GOTO 1
@laserlemon
laserlemon / BOUNCE.BAS
Created December 28, 2010 13:51
I was 11 years old.
' *This is the FIRST succesful "Bounce" program. This is THE original (other *
' *than the lines you're reading) so please make NO changes to the program.*
1 SCREEN 11
2 CLS
5 FOR z = 0 TO 20 STEP 20
10 CIRCLE (x, y), z
15 NEXT z
20 x = x + 4
21 y = y + 4
23 IF y > 432 THEN 32
@laserlemon
laserlemon / Rails 3 Environment
Created October 1, 2010 12:17
Snow Leopard, Homebrew, Git, RVM, Ruby, Rails, Passenger, Apache, MySQL, Memcached and ImageMagick
# 2010-10-01
#
# Mac OS X 10.6.3
# Homebrew 0.7
# Xcode 3.2.4
# Git 1.7.3.1
# RVM 1.0.12
# Ruby 1.9.2, 1.8.7
# Rails 3.0.0
# Passenger 3.0.0.pre4