Skip to content

Instantly share code, notes, and snippets.

@warp
warp / restore
Created May 13, 2019 00:12 — forked from mru2/restore
pg_restore a local db dump into Docker
# Create and download backup
heroku pg:backups:capture
heroku pg:backups:download
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
@warp
warp / config.ru
Created March 15, 2017 02:09 — forked from Aupajo/config.ru
ITTT trigger responder
require_relative 'environment'
app = Server.new do
trigger :turn_on_lightbulb do
# Make an API request...
Net::HTTP.post_form(URI('http://lightbulb.local'), 'status' => 'on')
# Response (any JSON-like data)
{ light_bulb: "on" }
end
@warp
warp / paperclip_migrations.rb
Created July 22, 2011 08:13 — forked from jystewart/paperclip_migrations.rb
Migration from attachment_fu database storage to paperclip
module PaperclipMigrations
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def add_paperclip_fields(table, prefix)
add_column table, "#{prefix}_file_name", :string
add_column table, "#{prefix}_content_type", :string