This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example of my desired syntax for behaviors in red | |
# /public/javascripts/red/example.red | |
class ExampleBehavior < Behavior | |
def initialize(options={}) | |
self.something = 5 | |
end | |
def on_click(event) | |
self.element.hide |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// public/javascripts/example.js | |
ExampleBehavior = Behavior.create({ | |
initialize : function() { | |
this.something = 5; | |
}, | |
onclick : function() { | |
this.element.hide(); | |
// ... more stuff | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* v1.0 | 20080212 */ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, font, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, | |
b, u, i, center, | |
dl, dt, dd, ol, ul, li, | |
fieldset, form, label, legend, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://github.com/jeremymcanally/rg/tree/master/lib/builtin/thoughtbot.rb | |
# installing | |
$ sudo gem install jeremymcanally-rg | |
# or download the .zip from github and then | |
$ rake gem | |
$ gem install pkg/rg-* | |
# builtin thoughtbot, bort, entp | |
$ rg -i http://gist.github.com/31533 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template(:nesquena) do | |
gem 'json' | |
gem 'mislav-will_paginate' | |
gem 'mocha' | |
gem 'thoughtbot-shoulda' | |
gem 'quietbacktrace' | |
gem 'haml' | |
gem 'authlogic' | |
plugin 'squirrel', :git => 'git://github.com/thoughtbot/squirrel.git' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/views/families/show.html.haml | |
= link_to 'Send Message', new_family_message_path(:family_id => @family.id, :category => 'Family') | |
# /app/controllers/messages_controller.rb | |
def new | |
@category = params[:category] | |
render :action => "messages/#{@category}_form", :layout => true | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Calendar helper with proper events | |
# http://www.cuppadev.co.uk/webdev/making-a-real-calendar-in-rails/ | |
# | |
# (C) 2009 James S Urquhart (jamesu at gmail dot com) | |
# Derived from calendar_helper | |
# (C) Jeremy Voorhis, Geoffrey Grosenbach, Jarkko Laine, Tom Armitage, Bryan Larsen | |
# Licensed under MIT. http://www.opensource.org/licenses/mit-license.php | |
## | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# controller when you post an update | |
Ping.notify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Looks like "Updated " + date.toRelativeString() + " ago" | |
Date.prototype.toRelativeString = function(){ | |
var now = new Date; | |
var later = this; | |
var offset = later.getTime() - now.getTime(); | |
var distanceInMinutes = (offset.abs() / 60000).round(); | |
if (distanceInMinutes == 0) { return 'a few seconds'; } | |
else if ($R(0,1).include(distanceInMinutes)) { return 'a minute'; } | |
else if ($R(2,44).include(distanceInMinutes)) { return distanceInMinutes + ' minutes';} | |
else if ($R(45,89).include(distanceInMinutes)) { return '1 hour';} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
max = 0 | |
999.downto(100) { |x| | |
999.downto(x) { |y| | |
prod = x * y | |
max = prod if (prod > max and prod.to_s == prod.to_s.reverse) | |
} | |
} | |
puts max |
OlderNewer