Skip to content

Instantly share code, notes, and snippets.

View flomotlik's full-sized avatar

Florian Motlik flomotlik

View GitHub Profile
@flomotlik
flomotlik / bashrc
Created May 22, 2012 15:06
Efficient Heroku
function h { heroku ${@:1:($#-1)} --app ${@: -1} ; }
function hp { h $@ production_app_name ; }
function hs { h $@ staging_app_name ; }
alias hpc="hp run console"
alias hsc="hs run console"
alias hpl="hp logs -t"
alias hsl="hs logs -t"
@flomotlik
flomotlik / gitconfig
Created October 12, 2012 09:28
Flo Gitconfig
[alias]
b = branch
a = add
c = commit -sv
cm = commit -svm
ca = commit --amend
co = checkout
cp = cherry-pick
d = diff
f = fetch
@flomotlik
flomotlik / Scaler.rb
Created November 15, 2012 15:25
Our scaling logic
if open_jobs < idle_workers.count
scaledown_workers
elsif all_workers_working? && jobs_queued? && (instances_count - workers.count) < open_jobs
scaleup_workers
end
@flomotlik
flomotlik / heroku_run.sh
Last active January 10, 2020 21:40
Heroku run script that exits with the correct error code
#! /bin/bash
array=( $@ )
len=${#array[@]}
app=${array[$len-1]}
args=${array[@]:0:$len-1}
buffer_file=/tmp/last_heroku_run_`date +%N`
/usr/bin/heroku run "$args; echo \$?" --app $app 2>&1 | tee $buffer_file
gem 'capybara'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, {js_errors:true, port:44678+ENV['TEST_ENV_NUMBER'].to_i, phantomjs_options:['--proxy-type=none'], timeout:180})
end
@flomotlik
flomotlik / codeshiptest.coffee
Last active December 14, 2015 14:49
Gist files for Casperjs Blogpost
#Run with casperjs test codeshiptest.coffee
casper.start 'https://www.codeship.io/', ->
@.clickLabel 'Blog', 'a'
@.then ->
@.test.assertUrlMatch 'http://blog.codeship.io'
casper.run ->
@.test.done(1)
#Run with casperjs test casperjstest.coffee
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)')
casper.start 'http://casperjs.org', ->
@.viewport(1024, 768);
@.thenClick('.dropdown-toggle')
@.then ->
@.clickLabel 'Tester API'
@.then ->
@.clickLabel 'Extending'
#Run with casperjs test translate.coffee
casper.start 'http://translate.google.com/', ->
@.sendKeys('#source', 'Guten Tag');
@.then ->
@.click '#gt-submit'
@.waitForText('Good day')
@.then ->
@.test.assertSelectorHasText '#result_box', 'Good day'
@.then ->
@flomotlik
flomotlik / Setup.sh
Last active December 16, 2015 07:39
Install postgres 9.2 and Postgis 2.0.x on Ubuntu
#!/bin/bash
#Postgres Repository
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
apt-get install postgresql-9.2 postgresql-contrib-9.2
#Install POSTGIS
apt-get install postgresql-server-dev-9.2 libgeos-dev libproj-dev libgdal-dev -y -q