This file contains 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
## This will not raise an error | |
## This will merely give result you might not think | |
## [Happened to me by bad cut-and-paste] | |
self.foo = "foo", | |
self.bar = "bar", | |
self.baz = "baz" |
This file contains 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
require File.dirname(__FILE__) + '/../spec_helper' | |
describe Norman do | |
include ActionController::UrlWriter | |
before(:each) do | |
ActionMailer::Base.delivery_method = :test | |
ActionMailer::Base.perform_deliveries = true | |
ActionMailer::Base.deliveries = [] | |
end |
This file contains 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
[15:48:37] <rsl> anyone understand why the API returns true for feed.publishUserAction but doesn't publish the feed? user enabled storys for the app. | |
[15:48:55] <stepcut> rsl: what size story? | |
[15:49:39] <rsl> the bundle has 2 sizes [one line and short story]. the api call returns true. all of nothing happens on the user's wall. | |
[15:50:09] <stepcut> rsl: has this code ever worked? | |
[15:50:34] <rsl> not sure what you mean by that... the api call returns true. | |
[15:50:39] <stepcut> rsl: let me rephrase. Was the code working, and then suddenly stopped? Or have you never had it working? | |
[15:51:31] <rsl> hrm... my code is calling the api. yes, my code works in that it calls the api. the api returns true for user.publishUserAction [instead of one of the multiple errors it has]. | |
[15:51:38] <rsl> not sure what to answer there. |
This file contains 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
class Person < ActiveRecord::Base | |
def self.find_recent | |
people = find( | |
:conditions => ["added_at > ? and deleted = ? and address is not null", Time.now.utc, false], | |
:order => "last_name, first_name") | |
end | |
# ... | |
end | |
This file contains 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
# fuck.rb | |
require "rubygems" | |
require "rack" | |
class Fuck | |
puts "class definition loaded" | |
def new | |
puts "initialized instance" | |
end |
This file contains 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
describe "PUT /password_resets/update" do | |
before(:each) do | |
@user = mock_model(User) | |
User.stub!(:find).and_return(@user) | |
end | |
describe "when successful" do | |
before(:each) do | |
@user.stub!(:update_attributes).and_return(true) | |
end |
This file contains 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
>> "test [two]".gsub(/(\[)/, '\1') | |
=> "test [two]" | |
>> "test [two]".gsub(/(\[)/, '\\1') | |
=> "test [two]" | |
>> "test [two]".gsub(/(\[)/, '\\\1') | |
=> "test \\1two]" |
This file contains 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
# Replacement for Rails' default button_to helper | |
# using HTML button element rather than HTML input element | |
def button_to(name, options = {}, html_options = {}) | |
html_options = html_options.stringify_keys | |
convert_boolean_attributes!(html_options, %w( disabled )) | |
method_tag = '' | |
if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s) | |
method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s) | |
end |
This file contains 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
var select_string = ""; | |
var select_string_last_updated = 0; | |
var select_options_hash = new Hash(); | |
var select_options_hash_keys = new Array(); | |
function initialize_select_data() { | |
$$("#indented_select_target option").each(function(el){ | |
without_indents = el.value; | |
select_options_hash.set(el.value, el.id); | |
}) |
This file contains 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
module Bar | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def bar | |
puts "bar's bar" | |
end | |
end |