Skip to content

Instantly share code, notes, and snippets.

@ddollar
ddollar / create-convox-support.sh
Created October 24, 2017 19:40 — forked from nzoschke/create-convox-support.sh
Creating a convox-support IAM User and Login
$ aws iam create-user --user-name convox-support
{
"User": {
"UserName": "convox-support",
"Path": "/",
"CreateDate": "2015-08-09T15:16:09.027Z",
"UserId": "AIDAIEXRZQYWRHLT6NX6O",
"Arn": "arn:aws:iam::901416387788:user/convox-support"
}
}
#!/bin/bash
# Usage:
# $ ./heroku-deploy.sh <app name> <git repo url> <heroku api key>
APP="$1"
REPO="$2"
APIKEY="$3"
echo "-----> Creating application $APP"
curl -u ":$APIKEY" -d "app[name]=$APP" -X POST https://api.heroku.com/apps -s > /dev/null
@ddollar
ddollar / vim.rb
Created January 29, 2013 19:49 — forked from uasi/vim.rb
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
@ddollar
ddollar / compact.md
Created April 3, 2012 18:07 — forked from geemus/compact.md
markdownish styleguide
$ heroku help apps:create
## Usage:
   heroku apps:create [NAME]
## Description:
   create a new app
## Options:
   --addons ADDONS
      a comma-delimited list of addons to install
   -b, --buildpack BUILDPACK

a buildpack url to use for this app

# Heroku S3 Database backup task
# by Nick Merwin (Lemur Heavy Industries) 10.08.09
# * dumps db to yaml, gzip's and sends to S3
#
# Setup:
# 1) replace APP_NAME and BACKUP_BUCKET with your info
# 2) add config/s3.yml like so (same as Paperclip's):
# production:
# access_key_id: ...
# secret_access_key: ...
# Person has_many cards has_many transaction_feeds.
# I would like to find all of the people with at least one transaction feed with the is_ach bool set to true:
SELECT DISTINCT(people.id) AS person_id FROM `people`
INNER JOIN `cards` ON cards.person_id = people.id
INNER JOIN `transaction_feeds` ON transaction_feeds.card_id = cards.id
WHERE (transaction_feeds.is_ach = 1)
GROUP BY person_id
HAVING COUNT(transaction_feeds.id) > 0;
# This works.
# Person has_many cards has_many transaction_feeds.
# I would like to find all of the people with at least one transaction feed with the is_ach bool set to true:
SELECT DISTINCT(people.id) AS person_id FROM `people`
INNER JOIN `cards` ON cards.person_id = people.id
LEFT JOIN `transaction_feeds` ON transaction_feeds.card_id = cards.id
WHERE (transaction_feeds.is_ach = 1)
GROUP BY person_id
HAVING COUNT(transaction_feeds.id) = 0;
# This works.
@ddollar
ddollar / snippet.rb
Created November 12, 2009 23:54 — forked from anonymous/snippet.rb
require 'rubygems'
require 'rack'
require 'ruby-debug'
class Rack::Nest
attr_reader :app
def initialize(app, options={}, &block)
@path = options[:path]
@ddollar
ddollar / gist:227359
Created November 5, 2009 20:43 — forked from atmos/gist:227332
require File.dirname(__FILE__) + '/spec_helper'
describe "The library itself" do
Spec::Matchers.define :have_no_tab_characters do
match do |filename|
@failing_lines = []
File.readlines(filename).each_with_index do |line,number|
@failing_lines << number + 1 if line =~ /\t/
end
@failing_lines.empty?
@ddollar
ddollar / hax.rb
Created October 26, 2009 19:50 — forked from wycats/hax.rb
Bundler Preinitializer
require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment"
class Rails::Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
end
def extend_environment