Skip to content

Instantly share code, notes, and snippets.

- if development?
%a#dev-fill-form{:href => ''} Fill form
%script
:plain
$(function () {
$('#dev-fill-form').click(function () {
data = {
email: 'bogus@example.com',
name: 'Bogus McGee'
}
Books I bought today at City Lights
Animal Liberation (Peter Singer)
The Path to Tranquility (The Dalai Lama)
This Year You Write Your Novel (Walter Mosley)
Food Politics (Marion Nestle)
Writings For A Democratic Society (Tom Hayden)
The Annotated Flatland (Edwin Abbot, notes by Ian Stewart)
What I Talk About When I Talk About Running (Haruki Murakami)
# BONUS PARTY GAME - Choose 1 or make your own! Is this DRY gone mad?
# A
named_scope :leads, :conditions => ["dancers.lead = ?", true], :joins => :dancer
named_scope :follows, :conditions => ["dancers.lead = ?", false], :joins => :dancer
# B
[
[:leads, true],
[:follows, false]
function parse_git_dirty {
git diff --quiet || echo " *"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
export PS1='\w $(parse_git_branch)\$ '
http://www.youtube.com/watch?v=5q_2Uy4g8vA
Parkour in Melbourne, Australia (my home town)
http://www.youtube.com/watch?v=ntFEoSV-PEc
Mental block - you know you can physically do it, but you need to cross the line from just believing you can do it
http://video.google.com/videoplay?docid=3022662956956514828
Long (90 minutes), the first section though is a really good intro to parkour - basic philosophy and methods
# Disclaimer
<<-EOS
This still just a crazy idea and I have not yet implemented it
Not for long though
Soon we take over the world
EOS
# Synopsis
test(object, method,
setup => expected_result,
@xaviershay
xaviershay / page.rb
Created February 16, 2009 00:17 — forked from chrislloyd/page.rb
Refactor this code: URL Matching Edition
--
So I have Pages, in a nested set so that each page has parent. That allows me to have urls like:
/foo/bar
where the Page with permalink 'foo' has a child with the permalink 'bar'. In my routes.rb I have a general catch-all route as my last route.
map.page '/*tree', :controller => 'pages', :action => 'show'
# Change login from script/console
# Grab the session_id from your server log
module ConsoleHelpers
def set_session(session_id)
Thread.current[:session_id] = session_id
end
def login(user)
session_id = Thread.current[:session_id]
~/Code/thehunge (master)$ git log
commit 27a59363ace6727da6cbd8deaf96cda264592bee
Author: Xavier Shay <xavier@rhnh.net>
Date: Thu Apr 2 17:56:32 2009 +1100
Train spike
commit 837491549d18bcc35c84bb0a8b682917ce3130fe
Author: Xavier Shay <xavier@rhnh.net>
Date: Thu Apr 2 16:48:54 2009 +1100
Need to build a "waiting list" for registrations.
Thinking about duplicating the table structure, rather than having an 'accepted' flag on the Registration.
This way it's easier to efficiently query stats, without having to worry about joining in registration or including 'accepted' in conditions/indexes.
Should be able to meta-program most of it, so not much extra code. Keeps data clean.
Registration
has N Options
has 1 Thing
... other things