Skip to content

Instantly share code, notes, and snippets.

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

Tiago Cássio tiagocassio

🏠
Working from home
View GitHub Profile
@lhas-dev
lhas-dev / LoginScreen.tsx
Last active December 7, 2019 01:03
Context API Sample for Authentication
import React, { useState, useEffect } from "react";
import { RouteComponentProps } from "react-router-dom";
import { useAuth } from "contexts/auth";
interface LoginProps extends RouteComponentProps {}
const Login = ({ history }: LoginProps) => {
const auth = useAuth();
// Redirect if already authenticated
@PavloBezpalov
PavloBezpalov / 1 setup vps
Last active August 19, 2024 15:09
Deploy Rails 5.1.1 to VPS(Ubuntu 16.04.2 LTS). Nginx mainline + pagespeed, Puma with Jungle, Capistrano3, PostgreSQL 9.6, RVM, Certbot
root# apt-get update
root# apt-get upgrade
// dependencies for Ruby
root# apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev \
libpcre3-dev unzip
// Node.js v7
root# curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
@wrburgess
wrburgess / 1_initial_migration.rb
Last active December 7, 2023 14:14
Setting up UUID columns for Rails 5+ models utilizing Postgres 9.4+
class InitialMigration < ActiveRecord::Migration[5.0]
def change
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto")
end
end