View date_time_fmt.js
var DotW = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Satruday' ];
var MotY = [ 'January', 'Feburary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
var dig2 = function(n) {
if (n > 9) return n.toString();
return "0" + n;
};
var formatDateUtc = function(date) {
var dddd = DotW[date.getUTCDay()];
var MMMM = MotY[date.getUTCMonth()];
View cool.rb
scope :find_by_eamil, ->(email) do
# Search team.
teams = joins(:team).where(teams: { email: email })
return teams unless teams.empty?
# Search user.
joins(:user).where(users: { email: email })
end
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]