Skip to content

Instantly share code, notes, and snippets.

View jeffrydegrande's full-sized avatar

Jeffry Degrande jeffrydegrande

View GitHub Profile
---- index.haml
%html
%head
%body.sessions-new
blah blah
----- _login.sass (2)
body.sessions-new
$(".grid input:checked").each(function(e){
var isPending = $(this).parents("tr:first").hasClass("pending");
var value = currencyToFloat( tr.children(".value").html() );
if (isDebit(value)) {
adjustDebit(value);
} else if (isCredit(value)) {
adjustCredit(value);
}
});
module Superfolio
module TestHelpers
include ActiveSupport::Concern
def login!(user = Factory(:user))
@current_user = user
@current_user.confirm! if @current_user.respond_to?(:confirm!)
sign_in @current_user
controller.stub!(:current_user).and_return(@current_user) if defined?(controller)
@current_user
end
class Post < ActiveRecord::Base
attr_accessible :title, :body
acts_as_commentable
# validations
belongs_to :author, :class_name => 'User', :foreign_key => 'user_id'
validates_presence_of :body
scope :with_title, :conditions => [ "title IS NOT NULL" ]
Face as diligencias procedidas pelo Departamento de Policia Federal, DEFIRO o
presente pedido de permanencia, vez que restou provado que o (a) estrangeiro (a) esta
casado de fato e de direito com conjuge brasileiro (a), salientando, todavia, que o ato
persistira enquanto for detentor da condicao que lhe deu origem.
def self.guid_from_entry(entry)
if entry.respond_to?(:guid) && entry.guid.present?
Digest::MD5.hexdigest(entry.guid.to_s)
elsif entry.respond_to?(:url) && entry.url.present?
Digest::MD5.hexdigest(entry.url.to_s)
elsif entry.respond_to?(:content) && entry.content.present?
Digest::MD5.hexdigest(entry.content.to_s)
else entry.respond_to?(:summary) && entry.summary.present?
Digest::MD5.hexdigest(entry.summary.to_s)
end
def self.guid_from_entry(entry)
result = ''
[:guid, :url, :content, :summary].each do |sym|
next unless entry.respond_to?(sym) and entry.send(sym).present?
result = Digest::MD5.hexdigest(entry.send(sym))
break
end
result
end
def self.guid_from_entry(entry)
[:guid, :url, :content, :summary].each do |sym|
entry.respond_to?(sym) and entry.send(sym).present? and return Digest::MD5.hexdigest(entry.send(sym))
end
end
def self.guid_from_entry(entry)
def entry.available_for_guid?(sym)
respond_to?(sym) && send(sym).present?
end
[:guid, :url, :content, :summary].each do |sym|
entry.available_for_guid?(sym) and return Digest::MD5.hexdigest(entry.send(sym))
end
end
ATTRIBUTES_ORDERED_FOR_CREATING_GUIDS = [:guid, :url, :content, :summary]
def self.guid_from_entry(entry)
def entry.can_make_guid_with?(symbol)
respond_to?(symbol) && send(symbol).present?
end
def entry.make_guid_from(symbol)
Digest::MD5.hexdigest(send(symbol))
end
ATTRIBUTES_ORDERED_FOR_CREATING_GUIDS.each do |symbol|