Skip to content

Instantly share code, notes, and snippets.

@drewinglis
drewinglis / Gemfile
Created June 9, 2011 00:50
Bundler issue
source 'http://rubygems.org'
gem 'nokogiri'
group :test do
gem 'mocha'
end
@drewinglis
drewinglis / connect.rb
Created April 7, 2012 18:25
Connect to Postgres on Heroku
require 'yaml'
require 'sequel'
if ENV['DATABASE_URL']
@database = Sequel.connect(ENV['DATABASE_URL'])
else
file = File.read("#{Rails.root}/config/database.yml")
config = YAML.load(file)
config = config[Rails.env]
config.symbolize_keys!
@drewinglis
drewinglis / gitolite-setup.sh
Last active December 15, 2015 21:39
Gitolite Setup
#!/bin/sh
# only tested on ubuntu
# add a 'git' user to store things under
sudo adduser \
--system \
--shell /bin/bash \
--gecos 'git version control' \
--group \
#!/bin/bash
run_hook () {
echo -en "\e[1;33m$4..\e[00m "
echo $1 $2 $3 | $GIT_DIR/hooks/hooks.d/$4
}
echo -en "\e[1;33mRunning hooks..\e[00m "
while read oldrev newrev refname; do
#!/bin/bash
# don't deploy if we don't want to
DEPLOY_BRANCH=$(git config --get s3-deploy.branch)
if [ -z ${DEPLOY_BRANCH} ]; then
echo "No deploy branch. Exiting. (Add the s3-deploy.branch config variable in the gitolite.conf file.)"
exit 0
fi
CURRENT_BRANCH=""
class Car
def initialize(options)
@color = options[:color]; @make = options[:make]; @model = options[:model]
end
def color; @color; end
def make; @make; end
def model; @model; end
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="testsuite-a" timestamp="2020-04-18T20:00:00.000Z" tests="3" time="10.500" errors="0" failures="0" skipped="0">
<testcase name="test case the first" classname="foo.bar.baz-test" time="3.000"/>
<testcase name="test case the second" classname="foo.bar.baz-test" time="4.000"/>
<testcase name="test case the third" classname="foo.bar.baz-test" time="3.500"/>
</testsuite>
<testsuite name="testsuite-b" timestamp="2020-04-18T20:00:15.000Z" tests="5" time="20.000" errors="0" failures="1" skipped="2">
<testcase name="first test case" classname="bar.baz.foo-test" time="5.000"/>
<testcase name="second test case" classname="bar.baz.foo-test" time="5.000"/>
@drewinglis
drewinglis / clojars.md
Created September 17, 2020 20:49
How to set up `lein deploy clojars` as of September 2020

How to set up lein deploy clojars (as of September 2020)

  1. Create an account: https://clojars.org/
  2. Create a deployment token: https://clojars.org/tokens/
  3. Create a ~/.lein/credentials.clj file, which you will shortly encrpyt. The file should look like this:
    {#"clojars"{:username "YOUR_USERNAME_HERE" :password "YOUR_DEPLOY_TOKEN_HERE"}}
    
  4. Encrypt with GPG: