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
| diff --git a/lib/fixjour/definitions.rb b/lib/fixjour/definitions.rb | |
| index 9bebbc4..ee9bf8d 100644 | |
| --- a/lib/fixjour/definitions.rb | |
| +++ b/lib/fixjour/definitions.rb | |
| @@ -19,13 +19,11 @@ module Fixjour | |
| # Defines the valid_*_attributes method | |
| def define_valid_attributes(name) | |
| define_method("valid_#{name}_attributes") do |*args| | |
| - valid_attributes = send("new_#{name}").attributes | |
| + valid_attributes = send("new_#{name}", *args).attributes |
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
| if Book.exists?(:title => title) # SELECT #=> true/false | |
| book = Book.find_by_title(title) # SELECT #=> Book | |
| ... | |
| if book = Book.find_by_title(title) # SELECT || nil | |
| ... | |
| if book = Book.find_by_title(title) && company = Company.find_by_name(name) | |
| ... |
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
| /* | |
| * jQuery unwrap plugin | |
| * GPL (GPL-LICENSE.txt) licenses. | |
| * Created by: Tiziano Treccani | |
| * | |
| * $Date: 2008-1-06 12:00:00 | |
| * | |
| * Version: 1.0 | |
| */ | |
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
| $.extend({ | |
| param: function( a ) { | |
| var s = [ ]; | |
| function add( key, value ){ | |
| s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value); | |
| }; | |
| // If an array was passed in, assume that it is an array | |
| // of form elements | |
| if ( jQuery.isArray(a) || a.jquery ) |
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
| $.extend({ | |
| param: function( a, nest_in ) { | |
| var s = [ ]; | |
| // check for nest | |
| if (typeof nest_in == 'undefined') nest_in = false; | |
| function nested(key) { | |
| if (nest_in) | |
| return nest_in + '[' + key + ']'; | |
| else |
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
| // works like Prototype's Function#bind | |
| // in Prototype: | |
| // $('element').observe('click', this.clickMethod.bind(this)); | |
| // with jQuery + $.shove: | |
| // $('#element).click($.shove(this.clickMethod, this)); | |
| $.extend({ | |
| shove: function(fn, object) { | |
| return function() { | |
| return fn.apply(object, arguments); |
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
| # HTML matcher for bacon | |
| # | |
| # it 'should display document' do | |
| # body.should have_element('#document') | |
| # end | |
| # | |
| # With content matching: | |
| # | |
| # it 'should display loaded document' do | |
| # body.should have_element('#document .title', /My Document/) |
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
| # Given a class with an array of files as paths e.g. | |
| # ['path/to/file.txt', 'other/file','path/file','file'] | |
| # Will organize them into a hash like | |
| # { | |
| # 'path' => { | |
| # 'to' => { | |
| # 'file' => {} | |
| # }, | |
| # 'file' => {} | |
| # }, |
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
| (function($) { | |
| $.extend(jqUnit, { | |
| // like rspec/bacon describe, sort of | |
| describe: function() { | |
| var args = [].splice.call(arguments, 0); | |
| return jqUnit.module('describe: ' + args.join(' ')); | |
| }, | |
| // shortcut to append 'should' to tests |
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
| On Ruby: | |
| What got me and a lot of other people into ruby: | |
| http://poignantguide.net/ruby/ | |
| Also the pickaxe (which an old version of is online for free): | |
| http://whytheluckystiff.net/ruby/pickaxe/ | |
| All of these guys books are pretty great: | |
| http://www.pragprog.com/titles | |