Skip to content

Instantly share code, notes, and snippets.

View leehambley's full-sized avatar

Lee Hambley leehambley

View GitHub Profile
@wjessop
wjessop / gist:14c51363acb189b17963
Last active August 29, 2015 14:03
90's house and dance
Please make suggestions to @will_j on twitter
- Additions
- Removals
- Ordering
- etc.
Rules:
- 90's Dance or house in the style of what's already on the list
@BrianTheCoder
BrianTheCoder / nginx.conf.erb
Created October 14, 2009 01:07
My erb template for a nginx.conf file for unicorn
user app app;
#user nobody;
worker_processes 6;
error_log /var/log/nginx/error.log;
pid /var/log/nginx/nginx.pid;
events {
worker_connections 1024;
}
@jtrupiano
jtrupiano / factory_girl_ext.rb
Created February 26, 2010 21:39
Add fixture_file_upload to factory_girl
require 'action_controller/test_process'
class Factory
module FixtureFileUpload
def fixture_file_upload(attr_name, path, mime_type=nil, binary=false)
uploaded_file = ActionController::TestUploadedFile.new(
Test::Unit::TestCase.respond_to?(:fixture_path) ? Test::Unit::TestCase.fixture_path + path : path,
mime_type,
binary
)
add_attribute attr_name, uploaded_file
@nu7hatch
nu7hatch / Gemfile
Created August 4, 2010 09:32
Padrino authentication with Warden
# ...
gem 'padrino-warden', :git => "git://github.com/zmack/padrino-warden.git"
gem 'authtools'
@cbrunnkvist
cbrunnkvist / gist:602983
Created September 29, 2010 15:45
Rails ActiveRecord aware fork() wrapper
# Rails ActiveRecord aware fork() wrapper
$child_pids = []
def wait_for_child(pid=nil)
begin
pid, child_result = (pid.nil? ? Process.wait2 : Process.waitpid2(pid))
unless child_result.exitstatus.zero?
$child_pids.each {|child_pid| Process.kill('TERM', child_pid) rescue true}
raise "Child PID:#{pid} exited with status #{child_result.exitstatus} - batch aborting"
end
rescue Errno::ECHILD
DELIMITER $$
CREATE PROCEDURE find_the_id(IN the_id INT)
BEGIN
SELECT name FROM items WHERE id = the_id;
END $$
DELIMITER ;
STORED_PROCEDURE = 'find_the_id'
STORED_PROCEDURE_FILE = 'StoredProcedure.sql'
class AddStoredProcedure < ActiveRecord::Migration
def self.up
sql_directory = File.join(File.dirname(__FILE__), 'sql')
conf = Rails::Configuration.new.database_configuration[RAILS_ENV]
sql_file = File.join(sql_directory, STORED_PROCEDURE_FILE)
host = conf['host'] ? conf['host'] : 'localhost'
database = conf['database']
username = conf['username'] ? conf['username'] : 'root'
class Item < ActiveRecord::Base
def self.find_the_id(id)
items = Item.find_by_sql("call find_the_id(#{id})")
items[0]
end
end
class BaseParticipant
include Ruote::LocalParticipant
def consume( workitem )
@workitem = workitem
begin
_, method, *args = workitem.fields['command'].split('/')
if arg
send( method, *args )
else
@patricksrobertson
patricksrobertson / cupid_button.sass
Created February 10, 2011 19:20
Sassifies the cupid-button done by GIANT ROBOTS. This is really a .scss . Github doesn't recognize it.
//Mixin that allows someone to define Cupid buttons outside of the green colors.
// $main-color: Primary button color.
// $btn-gradient: lighter color to blend with the main color.
// $bottom-border: Darker color for the bottom part of the button.
// $box-shadow: Color for the shadow.
// $text-shadow: Color for the text shadow.
// $text-color: Main color for the text.
@mixin cupid-button($main-color: #7fbf4d, $btn-gradient: #63a62f,
$bottom-border: #5b992b, $box-shadow: #96ca6d, $text-shadow: #4c9021,$text-color: #fff ) {
background: $main-color;