Skip to content

Instantly share code, notes, and snippets.

@ismarsantos
ismarsantos / Dokku v0.5.6 Rails App.md
Created December 21, 2018 01:34 — forked from Epigene/Dokku v0.5.6 Rails App.md
Knowledge-Base for getting a Rails5 app with Cable running on dokku v0.5.6

Dokku v0.5.6 Rails workflow

Straight to Maintenance

0. Set up Droplet

Initialize the droplet with dokku app pre-setup
@ismarsantos
ismarsantos / web-fonts-asset-pipeline.md
Created January 6, 2019 17:48 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

#!/usr/bin/env bash
echo "
----------------------
NODE & NPM
----------------------
"
# add nodejs 10 ppa (personal package archive) from nodesource
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
@ismarsantos
ismarsantos / style.css
Created May 6, 2019 19:13 — forked from thetutlage/style.css
Adonis websocket chat example style.css and html template
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,700');
html, body {
height: 100%;
width: 100%;
}
body {
font-family: 'Open Sans', sans-serif;
font-weight: 400;
@ismarsantos
ismarsantos / postgres-cheatsheet.md
Created May 21, 2019 03:59 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@ismarsantos
ismarsantos / cable_example.rb
Last active June 27, 2019 11:20
ActionCable User Identified
# https://github.com/rails/rails/issues/30917#issuecomment-337895075
# Common connection class
# app/channels/application_cable/connection.rb
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
end
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
@import "https://fonts.googleapis.com/css?family=Poppins:300, 400, 500, 600, 700";.iziToast-capsule{font-size:0;height:0;width:100%;transform:translateZ(0);backface-visibility:hidden;transition:transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1),height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1)}.iziToast-capsule,.iziToast-capsule *{box-sizing:border-box}.iziToast-overlay{display:block;position:fixed;top:-100px;left:0;right:0;bottom:-100px;z-index:997}.iziToast{display:inline-block;clear:both;position:relative;font-family:'Lato', Tahoma, Arial;font-size:14px;padding:8px 45px 9px 0;background:rgba(238,238,238,0.9);border-color:rgba(238,238,238,0.9);width:100%;pointer-events:all;cursor:default;transform:translateX(0);-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;min-height:54px}.iziToast>.iziToast-progressbar{position:absolute;left:0;bottom:0;width:100%;z-index:1;background:rgba(255,255,255,0.2)}.iziToast>.iziToast-progressbar>div{h
@ismarsantos
ismarsantos / 0_CONTRIBUTORS.md
Created October 15, 2019 09:21 — forked from evadne/0_CONTRIBUTORS.md
RVM + MRI + Capistrano + Puma + Sidekiq
  • Josh Goebel (@yyyc514): suggested lazy evaluation on set
@ismarsantos
ismarsantos / stimulus.md
Created January 30, 2020 20:21 — forked from mrmartineau/stimulus.md
Stimulus cheatsheet