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
| # Download the alpine image, which is more than 50% smaller than the base image | |
| docker pull postgres:12.3-alpine | |
| # macros is a the name of your app. My app is called "macros". | |
| # One volume per app ensures that we can isolate and back it up independently | |
| docker volume create macros | |
| docker run --name postgres \ | |
| -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 \ | |
| -v macros:/var/lib/postgresql/data postgres:12.3-alpine |
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
| # Definition | |
| module Project | |
| class Configuration | |
| attr_accessor :name, :author | |
| end | |
| end | |
| module Project | |
| extend self |
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
| describe '#educate' do | |
| it 'increments the education level by 1' do | |
| expect { person.educate }.to change { person.education_level }.from(1).to(2) | |
| end | |
| 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
| # https://stackoverflow.com/a/44672195/3013522 | |
| git reset --soft HEAD~1 |
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
| def self.❨╯°□°❩╯︵┻━┻ | |
| puts 'Calm down, yo.' | |
| 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
| #!/bin/bash | |
| git branch --merged master | grep -v 'master$' | xargs git branch -d |
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
| #!/bin/sh | |
| export BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | |
| echo "Deploying $BRANCH to staging" | |
| cap staging deploy |
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
| describe User do | |
| subject { create(:user, name: 'Wilson Silva', activated: true) } | |
| it { is_expected.to be_activated } | |
| its(:name) { is_expected.to eq('Wilson Silva') } | |
| 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
| sudo tail -f /proc/<pid>/fd/1 | |
| example: sudo tail -f /proc/2394/fd/1 |
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
| bundle exec rails g migration AddUserRefToProducts user:references | |
| # Generates | |
| class AddUserRefToProducts < ActiveRecord::Migration | |
| def change | |
| add_reference :products, :user, index: true | |
| end | |
| end |