Skip to content

Instantly share code, notes, and snippets.

View laserlemon's full-sized avatar

Steve Richert laserlemon

View GitHub Profile
@laserlemon
laserlemon / README.md
Last active August 29, 2015 13:59
Figaro 1.0 readme
@laserlemon
laserlemon / gist:9917908
Last active August 29, 2015 13:57
git push -fu
[12:06pm] laserlemon: hello!
[12:06pm] svninfo: laserlemon: hi! I'd like to automatically welcome you to #git, a place full of helpful gits. Got a question? Just ask it — chances are someone will answer fairly soon. The topic has links with more information about git and this channel. NB. it can't hurt to do a backup (type !backup for help) before trying things out, especially if they involve dangerous keywords such as --hard, clean, --force/-f, rm and so on.
[12:09pm] laserlemon: i have a question about git hooks. anybody up for it?
[12:09pm] laserlemon: i’m wondering if server-side clone hooks are anywhere on the roadmap
[12:10pm] ojacobson: laserlemon: what would the semantics be?
[12:10pm] ojacobson: (keep in mind that, from git's point of view, clone, fetch, and ls-remote are indistinguishable)
[12:10pm] laserlemon: i actually don’t know a lot about git hooks as it is, so i’m not sure
[12:11pm] Eugene: No, they are not.
[12:11pm] laserlemon: maybe it’d be useful to hear my use case
[12:12pm] Eugene: You
@laserlemon
laserlemon / keybase.md
Created March 27, 2014 18:28
KEYBASE ALL THE THINGS

Keybase proof

I hereby claim:

  • I am laserlemon on github.
  • I am laserlemon (https://keybase.io/laserlemon) on keybase.
  • I have a public key whose fingerprint is 98E1 8104 6431 0662 6353 2005 0B2D B485 5693 2D75

To claim this, I am signing this object:

@laserlemon
laserlemon / mic.ino
Created March 13, 2014 16:04
Ambient noise meter
#include <math.h>
#define PI 3.1415926535897932384626433832795
/****************************************
Example Sound Level Sketch for the
Adafruit Microphone Amplifier
****************************************/
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
const int led1 = 9; // the pin that the LED is attached to
@laserlemon
laserlemon / rails_issue_14229.rb
Last active August 29, 2015 13:56
Reproduction of Rails Issue #14229
# Activate the gem you are reporting the issue against.
gem 'rails', '4.0.3'
require 'rails'
require 'action_controller/railtie'
class TestApp < Rails::Application
config.root = File.dirname(__FILE__)
config.session_store :cookie_store, key: 'cookie_store_key'
config.secret_token = 'secret_token'
@laserlemon
laserlemon / Rainbow.ino
Created January 23, 2014 19:26
Single LED color chaser
#include <Bridge.h>
#include <Console.h>
int red = 11;
int green = 10;
int blue = 9;
int redLevel = 255;
int greenLevel = 0;
int blueLevel = 0;
int defaultStep = 5;
@laserlemon
laserlemon / balanced_error.rb
Created November 23, 2013 14:45
How to create Balanced errors with Factory Girl
FactoryGirl.define do
trait :balanced_error do
skip_create
initialize_with do
new(body: attributes)
end
end
factory :balanced_payment_required, class: Balanced::PaymentRequired do
@laserlemon
laserlemon / should_deliver.rb
Created May 29, 2013 14:55
A matcher for email delivery
require "rspec/mocks"
module ShouldDeliver
class Expectation
include RSpec::Mocks::ExampleMethods
def initialize(klass, email_name)
email = mock(email_name).as_null_object
email.should_receive(:deliver).once
@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'
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.