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] | |
email = [email protected] | |
name = Tiago Guedes | |
[alias] | |
co = checkout | |
lg = log --all --graph --decorate --oneline --abbrev-commit | |
cm = commit | |
ac = !git add -A && git commit | |
st = status -sb | |
tags = tag -l |
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
# | |
# Executes commands at the start of an interactive session. | |
# | |
# Authors: | |
# Sorin Ionescu <[email protected]> | |
# | |
# Source Prezto. | |
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then | |
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" |
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
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a 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
puts "--- Example 1:" | |
class Foo | |
def bar; "bar" end | |
end | |
a = Foo.new | |
puts "a.bar: #{a.bar}" | |
puts "--- Example 2:" |
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 Agb | |
@@team = %w(Barreto Douglas Fabio Giovanni Paulo Raphael Tiago) | |
def sort | |
team, i = @@team, 1 | |
while team.length > 0 | |
puts "| #{i} - #{team.delete_at(rand(team.length))} |" | |
i += 1 | |
end | |
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 Vehicle < ActiveRecord::Base | |
attr_accessor :direction | |
validates :name, presence: true | |
end | |
class Car < Vehicle | |
def turn_wheel(direction) | |
@direction = direction | |
puts "wheel was turned to the #{direction}" | |
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 Vehicle < ActiveRecord::Base | |
validates :name, presence: true | |
end | |
class Car < ActiveRecord::Base | |
belongs_to :vehicle | |
accepts_nested_attributes_for :vehicle | |
delegate :name, to: :vehicle | |
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
[user] | |
email = [email protected] | |
name = Tiago Guedes | |
[alias] | |
co = checkout | |
lg = log --all --graph --decorate --oneline --abbrev-commit | |
cm = commit | |
ac = !git add -A && git commit | |
st = status -sb | |
tags = tag -l |
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
require 'base64' | |
# Let's first create a non primitive class that will be dumped. | |
class People | |
POSSIBLE_NAMES = %w(foo bar) | |
@@count = 0 | |
def initialize(*attrs) | |
@@count += 1 |
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
# db/migrate/*_create_authentications.rb | |
class CreateAuthentications < ActiveRecord::Migration | |
def change | |
create_table :authentications do |t| | |
t.references :user, index: true | |
t.integer :provider, default: 0, null: false | |
t.jsonb :access_data, null: false, default: '{}' | |
t.timestamps | |
end |