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 Week | |
WEEKDAYS = %w( :segunda_feira, :terca_feira, :quarta_feira, :quinta_feira, :sexta_feira ) | |
def custom_attr_accessor(attr) | |
self.class_eval("def #{attr};@#{attr};end") | |
self.class_eval("def #{attr}=(val);@#{attr}=val;end") | |
end | |
WEEKDAYS.each do |day| |
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
function money2float (money) { | |
money = money.replace(/[\.\s]/g, "") | |
money = money.replace(",","."); | |
return parseFloat(money); | |
} |
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 EmbeddedSearch | |
def self.included(base) # :nodoc: | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def hierarchy | |
value = "" | |
klass = self | |
while klass.embedded? |
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
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"email":"email@email.com"}' http://0.0.0.0:3000/ |
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 ApplicationController < ActionController::Base | |
protect_from_forgery | |
respond_to :json | |
before_filter :authorize_user! | |
helper_method :current_user | |
def current_user | |
@current_user |
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
alias g='git' | |
alias gs='git status' | |
alias ga='git add' | |
alias gal='git add .' | |
alias gcm='git commit -m' | |
alias gcam='git commit -am' | |
alias gc='git checkout' | |
alias gcl='git clone' | |
alias gm='git merge' | |
alias gps='git push' |
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
config.model Phase do | |
# Found associations: | |
configure :_type, :text # Hidden | |
configure :_id, :bson_object_id | |
configure :created_at, :datetime | |
configure :updated_at, :datetime | |
list do | |
field :name | |
field :number | |
field :active |
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
$('#user_stats_resume #top_stats .stars .star').click(function(){ | |
rate = $(this).data('rate'); | |
stars = $('#user_stats_resume #top_stats .stars .star'); | |
stars.removeClass('selected'); | |
stars.each(function() { | |
$(this).addClass('selected'); | |
if ($(this).data('rate') === rate) return false; | |
}); | |
}); |
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 geocoder = new google.maps.Geocoder(); | |
function getState(zipcode) { | |
geocoder.geocode( { 'address': zipcode}, function (result, status) { | |
var state = "N/A"; | |
for (var component in result[0]['address_components']) { | |
for (var i in result[0]['address_components'][component]['types']) { | |
if (result[0]['address_components'][component]['types'][i] == "administrative_area_level_1") { | |
state = result[0]['address_components'][component]['short_name']; | |
// do stuff with the state here! |
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
$ -> | |
$('dt .iconFilter').click (e) -> | |
e.preventDefault() | |
objTable = $(@).closest('dl') | |
order = $(@).attr('class').match(/(a|de)sc/)[0] | |
sortTable { | |
clicked: $(@), | |
table: objTable, | |
order: order, | |
elemType: 'dd', |
OlderNewer