Skip to content

Instantly share code, notes, and snippets.

zulhfreelancer /
Last active Sep 21, 2021
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

rotvulpix / validarRUT.html
Last active Aug 19, 2021
HTML5 Chilean RUT Validator
View validarRUT.html
<!doctype html>
<html lang="es">
<meta charset="UTF-8">
<title>Validador de RUT HTML5</title>
<input type="text" id="rut" name="rut" required oninput="checkRut(this)" placeholder="Ingrese RUT">
<button type="submit">Validar RUT y Enviar Form</button>
ctalkington / Gemfile
Last active Jul 27, 2021
Nginx, Sinatra, and Puma.
View Gemfile
source :rubygems
gem "puma"
gem "sinatra"
RiANOl / gist:1077760
Last active Jun 30, 2021
AES128 / AES256 CBC with PKCS7Padding in Ruby
View gist:1077760
require "openssl"
require "digest"
def aes128_cbc_encrypt(key, data, iv)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize)
aes ='AES-128-CBC')
aes.key = key
aes.iv = iv
smazhara / gist:4740692
Last active May 16, 2021
Ruby AES128 encrypt-decrypt example
View gist:4740692
require "openssl"
require "base64"
include Base64
seyhunak / seeds.rb
Created Dec 7, 2013
Rails - Import SQL file as seed
View seeds.rb
unless Rails.env.production?
connection = ActiveRecord::Base.connection
connection.tables.each do |table|
connection.execute("TRUNCATE #{table}") unless table == "schema_migrations"
sql ='db/import.sql')
statements = sql.split(/;$/)
johanndt /
Last active Jul 6, 2020 — forked from dideler/
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu


Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main