Skip to content

Instantly share code, notes, and snippets.

View laserlemon's full-sized avatar

Steve Richert laserlemon

View GitHub Profile
@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
# 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="
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
@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)
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 |
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"
@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 }
@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
I'm writing a gem as an extension of multiple ORMs. I'd like to test the gem against 4 rubies, 4 ORMs and a few minor versions of each ORM. I have the 4 rubies specified in .travis.yml. I also have 13 gemfiles checked into the repo. That's 52 builds total. Each run should test only a specific version of a specific ORM using a specific Ruby.
To test a specific ORM, I need to set an "ADAPTER" ENV variable.
To test a specific version, I need to bundle using a different gemfile.
Solution #1
-----------
I could set the "rvm" rubies, set the "env" array for the 4 ORMs, and set the "gemfile" array to the 13 gemfiles. But that's going to run 208 builds. Plus many of them would be against ActiveRecord using a MongoMapper gemfile. Doesn't work.
@laserlemon
laserlemon / Gemfile
Last active December 14, 2015 16:48
Attempt to reproduce Figaro issue re: Bundler.with_clean_env
source 'https://rubygems.org'
gem 'rails', '3.2.12'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'