Skip to content

Instantly share code, notes, and snippets.

Joshua Mervine jmervine

Block or report user

Report or block jmervine

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View database_url.rb
unless ENV['DATABASE_URL'].present?
# convert current config/database.yml to ENV['DATABASE_URL'] format
c = ActiveRecord::Base.configurations[Rails.env]
database = c["database"]
username = c["username"]
password = c["password"]
adapter = c["adapter"] || "postgres"
hostname = c["host"] || "localhost"
View prun.sh
# run Procfiles without fore{man,go}
function _procline {
local line=""
if test -z "$1"; then
line=`cat Procfile | head -n1 | awk -F': ' '{ print $2 }'`
else
line=`cat Procfile | grep $1 | awk -F': ' '{ print $2 }'`
fi
echo $line
View sri.go
package sri
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"io/ioutil"
)
func Generate256(file string) (string, error) {
View maxdd.js
#!/usr/bin/env node
/*
* MaxCDN 2 DataDog
*
* Usage:
*
* $ npm install async moment maxcdn dogapi
* $ MAXCDN_ALIAS=<maxcdn_alais> \
* MAXCDN_KEY=<maxcdn_key> \
* MAXCDN_SECRET=<maxcdn_secret> \
View status-platform.md

Status: New

Notes on building out a new instance of stats.heroku.com on the platform.

heroku create --space sre-oregon --org heroku-sre --region oregon status-integration

# addons
heroku addons:create memcachier:100 -a status-integration
heroku addons:create pusher:startup -a status-integration
View main.go
/*Example Usage:
*
* $ PORT=3000 HOST=0.0.0.0 STATIC=./static PROXY_TARGET=http://localhost:5000 PROXY_PATH=/api go run main.go
*/
package main
import (
"fmt"
"log"
View howto_vendor_gems_for_heroku.md

How-to: Vendoring Ruby Gems

Outstanding Questions

A list of outstanding questions to be answered before finalizing this document.

  • How does on update vendored gems? Are the automatically updated when you run bundle update or do you have to run bundle package again?
  • How do you tell Heroku's build process to use bundle install --local --no-prune when building the build pack?
View branch_off_tag_and_re_tag.sh
# assuming your tag is '1.0.1'
# ensure latest code is local
git fetch --all --tag
# create branch off tag
git checkout -b branch-off-1.0.1 1.0.1
# your current branch should now be 'branch-off-1.0.1'
# ensure branch matches tag [optional]
View gist:87b20bd99dba7a09cde9
var assert = require('assert');
var exec = require('child_process').execFileSync;
// execFileSync throw an error if it returns a non-zero exit status
assert(exec('./index.js'));
/*
For the above to work index.js needs:
1. to be executable (i.e. 0755)
2. it's first line to contain `#!/usr/bin/env node`
View assert.js
var assert = require('assert');
var foo = 'foo';
assert.equal('foo', foo);
You can’t perform that action at this time.