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
Models | |
---------------------------------------- | |
Invitation | |
has_many :comments | |
Comment | |
belongs_to :invitation | |
Controller |
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 Object | |
>> def is_a_with_awesome? *args | |
>> args.any?{|klass| self.is_a? klass } | |
>> end | |
>> end | |
=> nil | |
>> User.first.is_a_with_awesome?(User, AuditStatus) | |
=> true | |
>> |
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
def update | |
@user = User.find(params[:id]) | |
if @user.update_attributes(params[:user]) | |
flash[:notice] = 'Dados salvos com sucesso' | |
redirect_to :action => 'edit' | |
else | |
flash[:error] = 'Falha ao salvar dados' | |
render :edit | |
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
# ~/.gitignore but GH doesn't allow subdirs in gists | |
zeus.json |
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 Object | |
def x | |
"Object's x" | |
end | |
end | |
class MyClass | |
x = "hello" | |
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
class Array | |
def bifurcate(&block) | |
self.each_with_object([[],[]]){|el, ary| ary[yield(el) ? 0 : 1] << el } | |
end | |
end | |
evens, odds = (1..10).to_a.bifurcate{|el| el % 2 == 0} |
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
def rps_result(m1, m2) | |
return {:r => {:s => :r, :p => :p}, | |
:p => {:r => :p, :s => :s}, | |
:s => {:p => :s, :r => :r}}[m1][m2] | |
end | |
puts rps_result(:r, :p) | |
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
OAuth = require('oauth').OAuth; | |
class UVClient | |
constructor: (@subdomain, @api_key, @api_secret, @callback=null, @token='', @secret='') -> | |
@api_url = "https://#{@subdomain}.uservoice.com" | |
@consumer = new OAuth null, null, @api_key, @api_secret, "1.0", null, "HMAC-SHA1" | |
request: (method, path, params={}, callback=null) -> | |
# Allow users to not specify empty params | |
if typeof params is 'function' |
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
#\ -p 3000 | |
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) | |
require 'config/environment' | |
require 'resque' | |
require 'resque/server' | |
app = Rack::Builder.new do | |
use Rails::Rack::Static | |
use Rails::Rack::LogTailer |
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
Please review.\r\n\r\n---------- Forwarded message ----------\r\nFrom: UserVoice <[email protected]>\r\nDate: Mon, Jan 9, 2012 at 12:44 PM\r\nSubject: ([email protected]) A brand-new front end for your UserVoice\r\naccount next week\r\nTo: [email protected]\r\n\r\n\r\nHi there,\r\n\r\nIn March, along with the announcement of UserVoice Helpdesk, we\r\nlaunched a brand-new front-end interface for UserVoice. You may have\r\nseen it...our account uses it, and every new signup since then has had\r\nit.\r\n\r\nWe\x92ve been moving accounts to this new interface over the last month.\r\nSo far, folks have no complaints. We\x92ve waited this long to move you\r\nbecause we wanted to make sure not to damage your custom design. We\x92ve\r\npainstakingly examined every custom design and fixed anything that\r\nmight break in migration. So this transition should go smoothly, with\r\nyour custom design remaining intact. We know you\x92ve spent a lot of\r\ntime on it, however, so we\x92ve set up a page which yo |
OlderNewer