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
class User | |
validates_presence_of :terms_accepted, :message => 'must be accepted' | |
protected | |
HUMANIZED_ATTRIBUTES = { | |
:terms_accepted => 'Terms and Conditions' | |
} | |
def self.human_attribute_name(attr) |
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
set ai ts=2 sts=2 et sw=2 | |
set autoread | |
set background=light | |
set complete-=i " Searching includes can be slow | |
set dictionary+=/usr/share/dict/words | |
set display=lastline | |
set ff=unix | |
set hidden | |
set listchars=tab:>\ ,trail:- | |
set listchars+=extends:>,precedes:< |
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(){s=document.createElement('script');s.type='text/javascript';s.src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js';document.body.appendChild(s);})(); | |
// remember to run jQuery.noConflict() as necessary. |
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
class C | |
def self.hi | |
puts 'hi' | |
end | |
end | |
class A | |
def self.inherited(sub) | |
eval("::#{sub} = Class.new(C)") | |
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
require 'rubygems' | |
require 'httparty' | |
module HttpConfig | |
def self.included(base) | |
base.send :include, HTTParty | |
base.base_uri 'http://192.168.3.218:8888/bridge/JSONControllerServlet.do' | |
base.format :json | |
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
class A | |
def self.say(msg) | |
puts "Hello from A #{msg}" | |
end | |
end | |
class B < A | |
def self.say(msg) | |
if msg.empty? | |
super |
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
class A | |
def self.hi | |
'hi from A' | |
end | |
end | |
class B < A | |
class << self | |
alias_method :b, :hi | |
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
function load_jquery(){ | |
var s=document.createElement('script'); | |
s.type='text/javascript'; | |
s.src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js'; | |
var head = document.getElementsByTagName("head")[0]; | |
var done = false; | |
s.onload = s.onreadystatechange = function(){ | |
if ( !done && (!this.readyState || | |
this.readyState == "loaded" || this.readyState == "complete") ) { |
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
// TODO: remove spaces and newlines | |
javascript:(function(){ | |
s=document.createElement('script'); | |
s.type='text/javascript'; | |
s.src='http://example.com/bookmarklet.js'; | |
document.body.appendChild(s); | |
})(); | |
// TODO: bookmarklet code needs to be in an anchor tag | |
// <a href="javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='http://example.com/bookmarklet.js';document.body.appendChild(s);})();">My Bookmarklet</a> |
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
Factory.define :administrator_base, :class => Administrator do |a| | |
a.password 'abc123' | |
a.password_confirmation 'abc123' | |
a.security_question_id 1 | |
a.security_question_answer 'xxxxxx' | |
a.activated_at Time.now | |
a.state 'active' | |
end | |
Factory.define :administrator do |a| |
OlderNewer