Skip to content

Instantly share code, notes, and snippets.

@ismarsantos
ismarsantos / prawn_io_image.rb
Created May 23, 2018 01:50 — forked from lappi-lynx/prawn_io_image.rb
Prawn PDF images with Base64 and StringIO
def render
pdf = Prawn::Document
pdf.image StringIO.new(Base64.decode64(splitBase64(BASE64_IMAGE_GOES_HERE)[:data])), at: [10, cursor - 50], width: 200, height: 125
end
def splitBase64(uri)
if uri.match(%r{^data:(.*?);(.*?),(.*)$})
return {
type: $1, # "image/png"
encoder: $2, # "base64"
@ismarsantos
ismarsantos / how_to_set_up_ssh_keys.md
Created June 5, 2018 23:20 — forked from stormpython/how_to_set_up_ssh_keys.md
Setting up ssh keys for remote server access

How to Set up SSH Keys

Create the RSA Key Pair

ssh-keygen -t rsa

Store the Keys and Passphrase

Once you have entered the Gen Key command, you will get a few more questions:

@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)
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
@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