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_tree ./ | |
| #= require application |
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 Payment | |
| def initialize cliente | |
| @cliente = cliente | |
| end | |
| def checkout order | |
| Cielo.numero_afiliacao = @cliente.numero_afiliacao | |
| Cielo.chave_acesso = @cliente.chave_acesso | |
| transaction = Cielo::Transaction.new | |
| transcation.create! order.attributes | |
| 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
| module Mongoid | |
| class MoneyField | |
| include Mongoid::Fields::Serializable | |
| def deserialize(object) | |
| return nil unless object | |
| Money.new(object) | |
| end | |
| def serialize(object) |
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 Order | |
| attr_accessor :id, :client, :products, :total, :status | |
| def pay!(adapter) | |
| response = adapter.pay(self) | |
| status = response | |
| end | |
| def paid? | |
| status == :paid |
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
| local = document.location.href; | |
| urlMappings = local.split("/"); | |
| context = urlMappings[3]; | |
| $.ajax({ | |
| url: '/'+context+'/alertas', | |
| }); | |
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
| ActiveRecord::Base.class_eval do | |
| def self.connection(key) | |
| establish_connection(key) | |
| self | |
| end | |
| end | |
| Model.connection(:development).all | |
| Model.connection(:production).all |
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
| mongod: sudo mongod | |
| spork: spork | |
| guard: guard |
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
| # Schema: User(name:string, password_digest:string, password_salt:string) | |
| class User < ActiveRecord::Base | |
| has_secure_password | |
| end | |
| user = User.new(:name => "david", :password => "", :password_confirmation => "nomatch") | |
| user.save # => false, password required | |
| user.password = "mUc3m00RsqyRe" | |
| user.save # => false, confirmation doesn't match | |
| user.password_confirmation = "mUc3m00RsqyRe" |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> | |
| <title>Home</title> | |
| </head> | |
| <body class="lift:content_id=main"> | |
| <div id="main" class="lift:surround?with=default;at=content"> | |
| <div> | |
| Hi, I'm a page that contains the time: |
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
| var AlbumController = Backbone.Router.extend({ | |
| routes: { | |
| "collection/:album_collection_id/album/:id" : "show", | |
| }, | |
| initialize: function(options) { | |
| }, | |
| show: function(album_collection_id, id){ | |
| var albums = new SingleAlbumCollection(album_collection_id, id); |