Skip to content

Instantly share code, notes, and snippets.

View GustavoCaso's full-sized avatar
🧩

Gustavo Caso GustavoCaso

🧩
View GitHub Profile
@GustavoCaso
GustavoCaso / gist:bbc71c3eda42d52d38f3
Created May 12, 2014 18:53
Tealeaf Rails Rapid Prototyping with Ruby on Rails - Lesson 1 Quiz
1. The data is store in table which have an unique identifier, usually call primary id,
also it is posible to create relathionship between tables through this primary key.
2. SQL(Structured Query Language) is the language to acces the tables in our databases to
insert, extract, delete or update.
3. There are Data and Schema, schema is a way to represent the different tables in our DataBase
what type of data and the name of the columns. And Data show the data, inside the tables,
every Database has it own schema.
4. Primary Key
5. A foreign Key is an identifier inside of a table that refers to another table.
6. ActiveRecord connects the rich objects of an application to tables in a relational database management.
@GustavoCaso
GustavoCaso / reviews_controller_spec.rb
Created July 3, 2014 08:03
Error with shared examples rspec, always return undefined method id for nil class
require 'spec_helper'
describe ReviewsController do
before(:each) do
signin_user
@video = Fabricate(:video)
end
describe 'Post Create' do
context 'Authenticated user Valid data' do
it 'create a new review with valid data' do
Write a model (ActiveRecord-based) for storing global configuration settings. It will be used for storing single values, for example an email address to send error emails to, or a flag enable/disable a particular feature. The interface must be simple and convenient, it should be possible to read and write specific configuration items. It must be possible to store values of these 4 types: string, integer, float and boolean. The model should come with a unit test and a migration.
Bonus: add caching within the model so that values are cached in regular Rails cache to minimize db load.
Please include a quick summary of use and commentary regarding any design decisions. Please indicate how long you spent working on this.
@GustavoCaso
GustavoCaso / gist:04814ca143e365c5cee2
Last active August 29, 2015 14:22
View Bechmark for JobAndTalent

#Loading Login Page without Any Library Google Chrome Network ###Rails Logs

Completed 200 OK in 27.0ms (Views: 22.6ms | ActiveRecord: 0.0ms)
Completed 200 OK in 35.1ms (Views: 29.0ms | ActiveRecord: 0.0ms)
Completed 200 OK in 25.6ms (Views: 21.3ms | ActiveRecord: 0.0ms)

Loading with Libraries

Google Chrome Network

@GustavoCaso
GustavoCaso / .vimrc
Last active July 12, 2016 21:37
Vim configuration
## Plugins
1. curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
2. cd ~/.vim/bundle && git clone https://github.com/scrooloose/nerdtree.git
3. cd ~/.vim/bundle && git clone https://github.com/kien/ctrlp.vim.git
4. cd ~/.vim/bundle && git clone git://github.com/tpope/vim-fugitive.git
5. cd ~/.vim/bundle && git clone [email protected]:altercation/vim-colors-solarized.git
* * *
@GustavoCaso
GustavoCaso / sublime_text.configuration.md
Last active September 14, 2015 17:00
Sublime text Configuration
@GustavoCaso
GustavoCaso / include_module.rb
Last active April 19, 2016 10:25
Testing alias_class for future project
module AliasClass
def self.included(base_class)
base_class.class_eval do
def self.alias_class(original_class, new_class)
self.const_set(new_class, original_class)
end
end
end
end
@GustavoCaso
GustavoCaso / clipboard.rb
Created July 1, 2016 14:28
Error Handling discussion
module Hybridflow
class CRMMessageParser
class Clipboard
attr_reader :message, :context, :error_handler
def self.car_rental_providers
providers = Pathify::CarProvider.all.map{ |p| p.name.try(:downcase).try(:strip) }.compact
providers.empty? ? _car_rental_providers : providers
rescue
_car_rental_providers
@GustavoCaso
GustavoCaso / flatten.ex
Last active July 31, 2017 21:00
Flatten Exercise
defmodule Flatten do
def flat(list) do
cond do
is_list(list) -> flat(list, []) |> Enum.reverse
true -> {:error, "Must pass a List"}
end
end
def flat([], acc), do: acc