Skip to content

Instantly share code, notes, and snippets.


Lee Smith leesmith

View GitHub Profile
leesmith / api_controller.rb
Created Aug 14, 2020 — forked from eliotsykes/api_controller.rb
Token Authentication in Rails API Controller and Request Spec
View api_controller.rb
# File: app/controllers/api/api_controller.rb
class Api::ApiController < ActionController::Base
# Consider subclassing ActionController::API instead of Base, see
protect_from_forgery with: :null_session
before_action :authenticate
def self.disable_turbolinks_cookies
skip_before_action :set_request_method_cookie
leesmith / deploy.log
Last active May 20, 2020
Heroku Rails 6 issue
View deploy.log
git push heroku tailwind:master
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 12 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 395 bytes | 395.00 KiB/s, done.
Total 5 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
leesmith /
Created Oct 9, 2019
Sync Nuxtjs dist folder to S3 and invalidate Cloudfront distribution
#!/usr/bin/env bash
# Sync generated site to S3 and invalidate Cloudfront distribution
if [ ! -f .env ]; then
echo "# Project environment not commit this file." >> .env
echo "AWS_CF_DIST_ID=" >> .env
echo "AWS_S3_URI=" >> .env
echo "Please add the necessary values to the .env file."
leesmith / postgres-commands.txt
Created Aug 12, 2019
Postgres dump & restore
View postgres-commands.txt
pg_dump --format=c --blobs --verbose --clean --file=some_db_name.dump some_db_name
pg_restore --verbose --no-acl --no-owner --dbname=some_db_name some_db_name.dump
leesmith / coinbase-clone.html
Created Jan 21, 2019
Tailwind CSS examples
View coinbase-clone.html
<!DOCTYPE html>
<meta charset='UTF-8'>
<link href="" rel="stylesheet">
<div class="font-sans bg-grey-lighter flex flex-col min-h-screen w-full">
leesmith / index.html
Created Oct 23, 2018
CSS maintenance server
View index.html
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Maintenance Page</title>
body{font-family:'IBM Plex Sans',sans-serif;line-height:1.6;font-size:1em;padding:0 20px}
#wrapper{width:100%;height:350px;margin:0 auto;position:absolute;top:50%;left:50%;margin-top:-175px;margin-left:-50%}

What separates the fleeting thrill of a “great idea” from the enduring rewards of great work?

These five facts:

  1. Great work is work that helps people. It’s not made great by accolades or praise from your peers… but by the experience of the people who actually use it. That’s work you can be proud of.
  2. Great work can be done by anyone. You don’t need to be “An Expert.” If you take the time to find out what people truly need, your work can help people now, and so you can do great work now.
  3. Great work is shipped work. Work that lives only in your brain or your hard drive can’t be great work. If you want your work to help people, you’ve got to get it into their hot little hands.
  4. Great work is work you can keep doing. If your work can’t sustain itself (aka with money and time off), you can’t keep doing it, which means you can’t keep helping people, and neither can your work. Great work takes care of you, so you can take care of it.
  5. Great work is never done. There can be nothing pe
leesmith / postgres-dump-all-and-restore.txt
Created Aug 25, 2017
Postgres dump cluster and restore
View postgres-dump-all-and-restore.txt
$ pg_dumpall > pg_all.sql
$ psql -U lsmith -f pg_all.sql postgres
leesmith /
Last active Nov 21, 2016
Git commands for keeping a tidy local repo

Prune remotes

git remote prune origin

Delete branches


leesmith /
Last active Jun 2, 2016
Upgrade Postgres via Homebrew
You can’t perform that action at this time.