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
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
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 'typhoeus' | |
require 'json' | |
# 1. Get data from http | |
# 2. Parsing JSON | |
# 3. Calculate score | |
# 4. Show score | |
class Http | |
attr_reader :client |
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
docker rm $(docker ps -q -f status=exited) | |
docker volume rm $(docker volume ls -qf dangling=true) | |
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) | |
docker rmi $(docker images | grep "<none>" | awk "{print $3}") -f | |
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 UserDiscount < ApplicationRecord | |
belongs_to :user | |
belongs_to :discount | |
def self.invalid_user_discounts | |
UserDiscount. | |
joins("INNER JOIN discount_segments ON user_discounts.discount_id = discount_segments.discount_id"). | |
joins("INNER JOIN user_segments ON user_discounts.user_id = user_segments.user_id"). | |
where("user_segments.segment_id <> discount_segments.segment_id") | |
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 Parser | |
END_OF_HEADERS = /\r\n\r\n/ | |
attr_accessor :method, :version, :headers, :path | |
def initialize | |
@data = "" | |
@completed = false | |
@headers = {} | |
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
# spec/fabricators/stuff.rb | |
Fabricator(:one_stuff, from: :open_struct) do | |
name 'Pedro' | |
end | |
Fabricator(:second_stuff, from: :hash) do | |
after_build do |s| | |
s['name'] = 'Jose' | |
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
eval "$(rbenv init -)" | |
alias be="bundle exec" | |
alias gg='git grep -i' | |
source $(brew --prefix)/etc/bash_completion | |
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin | |
GIT_PS1_SHOWDIRTYSTATE=true | |
export PS1='[\u@mbp \w$(__git_ps1)]\$ ' | |
if [ -n "$DISPLAY" -a "$TERM" == "xterm" ]; then | |
export TERM=xterm-256color | |
fi |
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
" Pathogen | |
execute pathogen#infect() | |
syntax on | |
" load ctrlp | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
" set <Leader> key as "," originally was \ | |
let mapleader="," |
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
# Add the following to /etc/hosts: | |
127.0.0.1 local.s3.endpoint local-bucket.local.s3.endpoint | |
# Run the following in your rails console, in order to create a bucket: | |
s3=AWS::S3.new( | |
:access_key_id => 'anything', | |
:secret_access_key => 'anything', | |
:s3_endpoint => 'local.s3.endpoint', | |
:s3_port => 4567, | |
:use_ssl => 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
# Enhance rails test with lib directory | |
# | |
# http://www.seanbehan.com/how-to-add-additional-sub-directories-to-the-default-rails-testunit-file-structure | |
namespace :test do | |
Rake::TestTask.new(:lib) do |t| | |
t.libs << "test" | |
t.pattern = 'test/lib/**/*_test.rb' | |
t.verbose = true | |
end |
NewerOlder