Skip to content

Instantly share code, notes, and snippets.

View laserlemon's full-sized avatar

Steve Richert laserlemon

View GitHub Profile
@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 / 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 / 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 / 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 / README.md
Last active August 29, 2015 13:59
Figaro 1.0 readme
@laserlemon
laserlemon / interactor.md
Created May 2, 2014 11:37
Old Interactor Documentation

What is an Interactor?

An interactor is a simple, single-purpose object.

Interactors are used to encapsulate your application's business logic. Each interactor represents one thing that your application does.

Context

An interactor is given a context. The context contains everything the interactor needs to do its work.

@laserlemon
laserlemon / cli.rb
Created May 23, 2014 23:21
Thor is hard.
# my_gem/cli.rb
require "thor"
require "my_gem/cli/foo_bar"
require "my_gem/cli/foo_baz"
require "my_gem/cli/install"
module MyGem
class CLI < Thor
@laserlemon
laserlemon / keybase.md
Created December 29, 2014 16:38
keybase.md

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 CDB6 894C 1DA5 35AB 8425 DD90 C650 CD1B 7189 C7DF

To claim this, I am signing this object:

@laserlemon
laserlemon / finish_optimization.rb
Last active August 29, 2015 14:15
Proposed Interactor v4 API
class FinishOptimization
include Interactor::Organizer
organize CommitImages
organize PushImages,
CreateOrUpdatePullRequest,
MarkAsFinished, if: -> { context.optimized_commit_sha }
end
@laserlemon
laserlemon / place_order.rb
Created April 21, 2015 22:01
Proposed Interactor 4.0 Syntax
class PlaceOrder
include Interactor
# What goes here?
before do
context.user ||= User.find(context.user_id)
end
def call