Skip to content

Instantly share code, notes, and snippets.

View cbartlett's full-sized avatar

Colin Bartlett cbartlett

View GitHub Profile
@cbartlett
cbartlett / Procfile
Created February 17, 2014 22:23
Easiest static site hosting on Heroku
web: node web.js
@cbartlett
cbartlett / keybase.md
Created February 18, 2014 16:14
keybase.md

Keybase proof

I hereby claim:

  • I am cbartlett on github.
  • I am cbartlett (https://keybase.io/cbartlett) on keybase.
  • I have the public key with fingerprint 4180 AF08 DF39 0D92 7A10  6075 0511 671C D8E3 3B47

To claim this, I am signing this object:

// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
# lib/core_ext/hash.rb
module CoreExt
module Hash
def deep_fetch(*keys, &default)
keys.inject(self) do |hsh, key|
hsh.fetch(key, &(proc { |*args| return default.call(*args) } if default))
end
end
end
#!/bin/bash
clean()
{
REMOTES="$@";
if [ -z "$REMOTES" ]; then
REMOTES=$(git remote);
fi
REMOTES=$(echo "$REMOTES" | xargs -n1 echo)
RBRANCHES=()
require 'spec_helper'
describe Event do
let(:event) { FactoryGirl.create(:event) }
let(:summer_long_event) { FactoryGirl.create(:summer_long) }
describe '.summer_long' do
subject { described_class.summer_long }
it { should include(summer_long_event) }
it { should_not include(event) }
@cbartlett
cbartlett / gist:7d2f027650ed0e74cbd3
Created November 11, 2014 16:36
removes orphaned records
model_base = Rails.root.join('app/models')
Dir[model_base.join('**/*.rb').to_s].each do |filename|
# get namespaces based on dir name
namespaces = (File.dirname(filename)[model_base.to_s.size+1..-1] || '').split('/').map{|d| d.camelize}.join('::')
# skip concerns folder
next if namespaces == "Concerns"
Error detected while processing User Auto commands for "ProjectionistDetect":
E716: Key not present in Dictionary: rake_command('static'))}}) | endif
E116: Invalid arguments for function split(rails#app().rake_command('static'))}}) | endif
E116: Invalid arguments for function projectionist#append
UpdateLastColumn failed to find bufnr 9 in w:BufKillList
UpdateLastColumn failed to find bufnr 9 in w:BufKillList
Shoes.setup do
gem "mime-types"
gem "open4"
source "http://gems.github.com/"
gem "mojombo-grit"
end
require 'mojombo-grit'
repo = Grit::Repo.new(Dir.pwd)
@cbartlett
cbartlett / average_deploy.rb
Created April 16, 2015 15:42
How often do you deploy to Heroku?
#!/usr/bin/env ruby
# Copyright 2015 Colin Bartlett, Inc.
# MIT Licensed: http://opensource.org/licenses/MIT
# Usage: ./average_deploy.rb your-heroku-app-name
require 'time'
dates = `heroku releases -n 50 -a #{ARGV[0]} | grep Deploy`