Skip to content

Instantly share code, notes, and snippets.

View jsteiner's full-sized avatar

Josh Steiner jsteiner

View GitHub Profile

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@jsteiner
jsteiner / gist:2957762
Created June 20, 2012 02:12 — forked from croaky/gist:2957583
Getting a production dump from Heroku backups
curl -o latest.dump `heroku pgbackups:url --app project-production`
pg_restore --verbose --clean --no-acl --no-owner -d project_development latest.dump
rm latest.dump
find ~ -name '*.log' -print0 | xargs -0 -L1 stat -f'%z %N' | sort -rn | tee fat-logfiles.txt | head
awk '{ total += $1 } END { printf "total: %5.2f MiB\n", total/1024/1024 }' < fat-logfiles.txt
@jsteiner
jsteiner / guest_manages_favorites_spec.rb
Created April 22, 2013 14:27
Example of page objects
require 'spec_helper'
feature 'Guest manages favorites', :js do
scenario 'can interact with the list of favorites' do
property = create(:property, :boston)
alternate_property = create(:property, :boston)
make_all_properties_available
search do
@jsteiner
jsteiner / flashcards.rb
Last active December 19, 2015 18:48
Flashcards
module Flashcards
class Card
attr_accessor :front, :back
def initialize(front, back)
@front = front
@back = back
end
def play
@jsteiner
jsteiner / rails.vim
Created October 11, 2013 14:19
Current Rails.vim projections
let g:rails_projections = {
\ "config/projections.json": {
\ "command": "projections"
\ },
\ "spec/features/*_spec.rb": {
\ "command": "feature",
\ "template": "require 'spec_helper'\n\nfeature '%h' do\n\nend",
\ },
\ "spec/support/*.rb": {
\ "command": "support"
" Edit another file in the same directory as the current file
map <Leader>e :e <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>s :split <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>v :vsplit <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>te :tabe <C-R>=expand("%:p:h") . '/'<CR>
let g:rails_projections = {
\ "config/projections.json": {
\ "command": "projections"
\ },
\ "spec/features/*_spec.rb": {
\ "command": "feature",
\ "template": "require 'spec_helper'\n\nfeature '%h' do\n\nend",
\ },
\ "spec/support/*.rb": {
\ "command": "support"
@jsteiner
jsteiner / app.css
Last active December 30, 2015 09:49
.wufoo {
background-color: red !important;
}
form.wufoo .info h2 {
color: red !important;
}
@jsteiner
jsteiner / projections.json
Last active June 14, 2016 17:38
Example Rails.vim projections for a Backbone.js project.
{
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.coffee",
"template": "class @AppName.Models.%S extends Backbone.Model"
},
"app/assets/javascripts/collections/*.coffee": {
"command": "jcollection",