vince
Change (Amend) commit message
if you just made a commit and want to change the message git commit --amend -m "better commit message"
Git stash
takes your uncommitted changes (both staged and unstaged), saves them away for later use, and then reverts them git stash -u git checkout master git checkout crazy-experiment git stash pop stash ...
Serialized Hash in Rails form
review of what a hash is ```ruby schedule = {mon: true, tue: false, wed: true} schedule[:mon] => true schedule[:tue] => false schedule[:wed] => true schedule[:thu] => nil schedule.class => Hash ```...
Rebase experimental branches
Fake everyone (including yourself) by squashing stupid commits on your experimental branch and then merging a pristine commit to master git checkout -b crazy-experiment do lots of stupid commits ...
Squash experimental branch
git rebase -i [SHA] "squash" melds the commit into the previous one (the one in the line before) https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history https://dev.to/e...
Jonas
rails console ``` Running via Spring preloader in process 61215 Loading development environment (Rails 6.0.3.2) irb(main):001:0> a = Availability.first Availability Load (0.8ms) SELECT "availabi...
Find and kill a process
% ps aux | grep puma 52480 0.0 0.0 4268176 508 s000 R+ 10:10AM 0:00.00 grep puma 52050 0.0 0.8 4517160 142512 s000 T 9:52AM 0:27.34 puma 4.3.5 (tcp://localhost:3000) [crazya...
Using the Postgres interval data type
rails generate model Availability ```ruby class CreateAvailabilities < ActiveRecord::Migration[6.0] def change reversible do |dir| dir.up do execute "ALTER DATABASE \"#{connecti...
Use PostgreSQL's interval type as ActiveRecord::Duration
I couldn't bring myself to use an integer as a db column with the amazing interval available. Unfortunately Rails just sees it as a string, but here's how you can get it to work ruby class CreateAv...
Recurring Events in Rails using recurrence gem
https://github.com/fnando/recurrence
Recurring Events in Rails using Montrose
https://rossta.net/blog/recurring-events-in-ruby.html https://speakerdeck.com/rossta/recurring-events-with-montrose?slide=4
Copy just one file from one branch to another
git checkout master # switch to master branch git checkout experiment -- db/schema.xmi # copy file from experiment branch
Recurring Events in Rails using ice_cube
Get this gem https://github.com/seejohnrun/ice_cube Go Rails videos https://www.youtube.com/watch?v=0tczntjIrKc https://www.youtube.com/watch?v=-nZedbdrTd8 Drifting Ruby videos https://www.youtube....
Create Amazon IAM user
Step 1: https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-startedcreate-admin-group.html Step 2: https://console.aws.amazon.com/iam/home?#/securitycredentials
SendGrid on Heroku
Not sure why everything I looked online makes it look complicated but this worked. And you don't even need to add the SendGrid gem. /config/environments/production.rb ruby config.action_mailer.de...
Sample workflow to undo changes
Understand this simple workflow to properly understand how revert and reset works ``` ~/code/gitfaffing % pico hello.txt ~/code/gitfaffing % git init ~/code/gitfaffing % git add . ~/code/gitfaffing...
Merge
Fast Forward Merge when you just have a simple branch from the master tip ``` Start a new feature git checkout -b new-feature master Edit some files git add <file> git commit -m "Start a feature" E...
Tips and Tricks
see compact tree of all your commits git log --graph --all --oneline --decorate if you do this a lot, you can add it as an alias ~/gitfaffing % git config --global alias.go 'log --graph --all --...
Working Directory, Staging Area, and Repository
(a) The working directory contains the files that are not handled by git. These files are also referred to as "untracked files." (b) Staging area contains the files that are going to be a part of t...