Skip to content

Instantly share code, notes, and snippets.

View guihatano's full-sized avatar
🏠
Working from home

Guilherme Y. Hatano guihatano

🏠
Working from home
View GitHub Profile
@guihatano
guihatano / .bashrc
Created August 30, 2021 14:39
git bash show branch name
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\e[01;32m\]\u@\h \[\e[01;34m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ "
@guihatano
guihatano / cheatsheet.rb
Created December 6, 2023 14:15 — forked from mabenson00/cheatsheet.rb
Rails ActiveRecord JSON cheatsheet
# Basic key operators to query the JSON objects :
# #> : Get the JSON object at that path (if you need to do something fancy)
# -> : Get the JSON object at that path (if you don't)
# ->> : Get the JSON object at that path as text
# {obj, n} : Get the nth item in that object
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE
# Date
# date before today