Skip to content

Instantly share code, notes, and snippets.

View thiagoramos23's full-sized avatar

Thiago Ramos thiagoramos23

View GitHub Profile
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@thiagoramos23
thiagoramos23 / Rakefile.rb
Created August 23, 2017 23:24 — forked from drogus/Rakefile.rb
This is the example contents of the Rakefile, which you would use to run active record tasks without using Rails. It assumes using the same directories as rails uses: `db/migrate`, `config/database.yml`.
require 'bundler/setup'
require 'active_record'
include ActiveRecord::Tasks
db_dir = File.expand_path('../db', __FILE__)
config_dir = File.expand_path('../config', __FILE__)
DatabaseTasks.env = ENV['ENV'] || 'development'
@thiagoramos23
thiagoramos23 / deploy.rb
Created November 19, 2015 17:42 — forked from stas/deploy.rb
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
@thiagoramos23
thiagoramos23 / RestServiceMultipart.swift
Last active October 28, 2015 15:03
Send Images wth multipart IOS Swift
func POST(delationType: String, description: String, referenceType: String, latitude: Double, longitude: Double, photos: [Photo], completionHandler: (object:AnyObject?, success: Bool) -> Void) -> Void {
let url:NSURL? = NSURL(string: "http://ima.rogalabs.com/api/v1/ombudsmen")
let request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "POST"
// Set Content-Type in HTTP header.
let boundary = "---------------------------14737809831466499882746641449"; // This should be auto-generated.
let contentType = "multipart/form-data; boundary=" + boundary
request.setValue(contentType, forHTTPHeaderField: "Content-Type")
@thiagoramos23
thiagoramos23 / capybara cheat sheet
Last active September 1, 2015 11:42 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
Steps to Configuring for Xcode Developemnt:
1. Install Xcode
2. Ruby
3. Install RubyGems
4. Install LiftOff
-- https://github.com/thoughtbot/liftoff
5. Download Project from Bitbucket
6. Run the following command from the project folder:
-- liftoff
class AccountTransaction
. . .
def transfer( fromAccount , toAccount , amount )
fromAccount . debt( amount )
toAccount . credit( amount )
send_notifications_to_accounts( fromAccount , toAccount )
end
def paypal_transfer_to( fromAccount , toAccount , amount )
#PayPal stuff
def paypal_transfer_to( account , amount )
#PayPal stuff
email_sender . send_account_changed_notification( account )
email_sender . send_account_changed_notification( self )
end
class BankAccount < ActiveRecord : :Base
. . .
def transfer_to( account , amount )
self . debt( amount )
account . credit( amount )
email_sender . send_account_changed_notification( account )
email_sender . send_account_changed_notification( self )
end
. . .
@thiagoramos23
thiagoramos23 / bank_account_2.rb
Created July 19, 2015 03:27
Bank Account another example
class BankAccount < ActiveRecord : :Base
. . .
def transfer_to( account , amount )
self . debt( amount )
account . credit( amount )
email_sender . send_account_changed_notification( account )
email_sender . send_account_changed_notification( self )
end
. . .
end