vince

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...

  • Updated about 1 year ago by vince
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...

  • Updated about 1 year ago by vince
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...

  • Updated about 1 year ago by vince
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...

  • Updated about 1 year ago by vince
Recurring Events in Rails using recurrence gem

https://github.com/fnando/recurrence

  • Updated about 1 year ago by vince
Recurring Events in Rails

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

  • Updated about 1 year ago by vince
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

  • Updated about 1 year ago by vince
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...

  • Updated about 1 year ago by vince
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 --...

  • Updated about 1 year ago by vince
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...

Undoing Changes

Undo latest commit using git revert HEAD ``` ~/code/gitfaffing % git log --oneline 481db44 (HEAD -> master) crazy edit of world.txt be880c6 added world.txt and edited hello.txt aa1a9d2 init ~/code/...

Branch

list branches git branch ` create (and checkout) new branch git checkout -b crazy-experiment ` delete branch (after merging) git branch -d crazy-experiment delete branch (not merged but you don...

Cloning an existing repository

  • Updated about 1 year ago by vince
Initializing a new Git repo

/Users/Sosie/code/lukeko ruby git init git add . git commit -m "init" Make changes and then ruby git commit -a -m "summary of what changed" If you add a file ruby git add . git commit -a -m "summ...

  • Updated about 1 year ago by vince