Skip to content

Instantly share code, notes, and snippets.

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@marcelonmoraes
marcelonmoraes / Time Zone.md
Created August 29, 2024 02:47 — forked from JamesYang76/Time Zone.md
Time Zone for rails

Time zones

There are trhee diffrent time zones in rails

  • System - The server time zone
  • Application - Rails application use own time zone
  • Database - Default is UTC, but do not change it

Cautions

  • config.time_zone should be set when an app dose not support multiple time zones
  • Do not use Date/Time API using system time zone
  • Date could be incorrect by being converted from datetime or time to date
mkdir ~/pg_backup/
sudo -u postgres pg_dump test > pg_dump
tar -cvf ~/pg_dump.tar ~/pg_dump
rm -rf ~/pg_dump
#https://github.com/andreafabrizi/Dropbox-Uploader
~/dropbox_uploader.sh upload ~/pg_dump.tar /pg_dump.tar
rm ~/pg_dump.tar
@marcelonmoraes
marcelonmoraes / README.md
Created May 11, 2021 21:01 — forked from ingeniousgenius/README.md
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

require 'action_mailer'
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'email.com',
:user_name => 'username',