Skip to content

Instantly share code, notes, and snippets.

View seanhandley's full-sized avatar
🧀
Eating cheese

Sean Handley seanhandley

🧀
Eating cheese
View GitHub Profile
# Offering from lee:
class NarrativeController
class << self
def next_collaberator_for(story)
raise ArgumentError "Require an instance of Story" unless story.is_a? Story
collab_ids = story.collabs.map(&:id)
last_collab_id = story.fics.collabs.last.collab_id
last_collab_index = collab_ids.index(last_collab_id) || -1
next_collab_id = collab_ids[last_collab_index + 1]
#flash
- flash.each do |key, value|
%div{:class => key, :id => "flash_#{key}"}= value
:javascript
Event.observe(window, 'load', function() {
$('flash_#{key}').fade({ duration: 3.0 });
});
www.ipchicken.com
www.ipdog.com
www.ipmonkey.com
www.ipbear.com
www.ipcow.com
www.ipdragon.com
www.ipgoat.com
www.ipspider.com
www.ipferret.com
www.iptoad.com
~/Code/watched.it-client/build (master) $ git pull origin refactor
remote: Counting objects: 30, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 22 (delta 5), reused 22 (delta 5)
Unpacking objects: 100% (22/22), done.
From github.com:leehambley/watched.it-client
* branch refactor -> FETCH_HEAD
CONFLICT (delete/modify): src/mac/nowlistening.m deleted in 1068f6a93b1896321bfc6118072a4e0c97facf56 and modified in HEAD. Version HEAD of src/mac/nowlistening.m left in tree.
Removing src/nowlistening.h
Removing src/shared/record_struct.cpp
alias redo='sudo \!-1' # When you forget to use 'sudo', just do 'redo' to rerun the last command using sudo.
class Roman
Symbols = { 1=>'I', 5=>'V', 10=>'X', 50=>'L', 100=>'C', 500=>'D', 1000=>'M' }
Subtractors = [ [1000, 100], [500, 100], [100, 10], [50, 10], [10, 1], [5, 1], [1, 0] ]
def initialize(i)
@i = i
end
def to_s
class Object
def method_missing(symbol, *args, &block)
if(args.nil?)
symbol.to_s
else
"#{symbol.to_s} #{args[0].to_s}"
end
end
end
require 'rubygems'
require 'active_record'
class Contact < ActiveRecord::Base
begin
establish_connection(:adapter => 'mysql',
:database => 'contacts',
:host => '127.0.0.1',
:username => 'root',
# Get the current branch of the current git project
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
# Get the current Gemset
function parse_rvm_gemset {
gemset=$(rvm gemset name 2> /dev/null)
echo ""${gemset}""
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'