Skip to content

Instantly share code, notes, and snippets.

View codespore's full-sized avatar
🔍
Looking for my next mission

Adrian Teh codespore

🔍
Looking for my next mission
View GitHub Profile
@codespore
codespore / gist:14254268e2a87843d48a722b75f4a248
Created September 8, 2019 02:49 — forked from dirkgroenen/gist:07c3e8e4bc7e08bc3232ae0bdd6a0ba5
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@codespore
codespore / ruby_on_rails_deployment.md
Created August 23, 2019 17:37 — forked from zentetsukenz/ruby_on_rails_deployment.md
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

#Docker

##Files and Folders.

|
|\_ app
|...
|\_ docker
| |
@codespore
codespore / README-Template.md
Created July 10, 2017 19:22 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@codespore
codespore / gist:7014ebf319db3ded52bad62185f7de56
Created August 22, 2016 00:48 — forked from arjunvenkat/gist:1115bc41bf395a162084
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@codespore
codespore / entypo.css
Last active August 29, 2015 14:12 — forked from pnull/entypo.css
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
jQuery.ajaxSetup(
beforeSend: (xhr) ->
xhr.setRequestHeader('X-Auth-Token',
App.Session.getAuthenticationToken())
)
# ...
class App.Session
# ...
getAuthenticationToken: ->
Get the Heroku db as detailed here:
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup
1. heroku pgbackups:capture
2. heroku pgbackups:url <backup_num> #=>backup_url
- get backup_num with cmd "heroku pgbackups"
3. curl -o latest.dump <backup_url>
Then locally do:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump
@codespore
codespore / unicorn.sh
Created January 28, 2013 00:39 — forked from troex/unicorn.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs mysql
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: unicorn initscript
# Description: Unicorn is an HTTP server for Rack application
### END INIT INFO