Skip to content

Instantly share code, notes, and snippets.

View hooptie45's full-sized avatar
:shipit:
Focusing

Shaun Hannah hooptie45

:shipit:
Focusing
  • Bloomberg
  • Washington, DC
View GitHub Profile
(defn test []
)
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@hooptie45
hooptie45 / rails31init.md
Created October 14, 2011 22:47 — forked from jraines/rails31init.md
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
@hooptie45
hooptie45 / dsl.rb
Created August 19, 2011 11:19
FlexGen
app "App", :base => "com.test" do
# Models
actor "Customer" do
attribute "first_name", :view_type => "String"
attribute "last_name", :view_type => "String"
# Customer Signals
sig "New"
sig "Destroy"
end
@hooptie45
hooptie45 / friend-buy.io
Created August 19, 2011 08:18
Friend Buy Redis
> SET server:name "bidja"
"OK"
> SADD item:item1:bidders 123456
true
> SADD item:item1:bidders 333333
true
> SADD item:item1:bidders 555555
true
> SADD item:item1:bidders 123456
true
require 'flexgen/model_builder'
require 'metamodel/as'
include ASMetaModel
def auto_build
FlexGen::ModelBuilder.build(ASMetaModel) do
app "App", :base => "com.test" do
# Models
actor "Customer" do
attribute "first_name", :view_type => "String"
attribute "last_name", :view_type => "String"
@hooptie45
hooptie45 / LICENSE.txt
Created June 6, 2011 07:01 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
%w{readline rubygems bond}.each {|e| require e }
Bond.start
history_file = File.join(ENV["HOME"], '.mini_irb_history')
IO.readlines(history_file).each {|e| Readline::HISTORY << e.chomp } if File.exists?(history_file)
while (input = Readline.readline('>> ', true)) != 'exit'
begin puts "=> #{eval(input).inspect}"; rescue Exception; puts "Error: #{$!}" end
end
File.open(history_file, 'w') {|f| f.write Readline::HISTORY.to_a.join("\n") }
load 'config/deploy/settings.rb'
load 'config/deploy/symlinks.rb'
load 'config/deploy/passenger.rb'
load 'config/deploy/callbacks.rb'
load 'config/deploy/maintenance.rb'
load 'config/deploy/git.rb'