Skip to content

Instantly share code, notes, and snippets.

View A5308Y's full-sized avatar

Andreas Hellwig A5308Y

  • Bitbirds
  • Leipzig
View GitHub Profile
"Windom, MN [Windom Municipal Airport], USA",
"Montevideo, MN [Montevideo-Chippewa County Airport], USA",
"La Gomera Airport",
"Hebei Handan Airport",
"Osvaldo Vieira International Airport",
"Sam Mbakwe International Cargo Airport",
"Weihai Dashuibo Airport",
"Aéroport de Lille",
"Dubai International Airport",
"Brussels Midi Railway Station",
LATEST_DUMP=$(ls -tr ~/tempfiles | tail -n 1)
dropdb -h localhost -U webapp webapp_development && createdb -h localhost -U webapp webapp_development
psql -h localhost -U webapp -f ~/tempfiles/$LATEST_DUMP -d webapp_development -e
require 'integration'
require 'bigdecimal/math'
# Calculates the weighted costs of ER credits from a list of given vintages and their contained ERs.
# Early vintages have higher prices allowing later vintages to be less effected by initial costs.
class VintageCostCalculation
# Calculating raises an error if the sum of vintage ERs multiplied with the ER costs in this
# vintage differs from the given project costs by more than ACCEPTABLE_PROJECT_COST_DIFFERENCE.
ACCEPTABLE_PROJECT_COST_DIFFERENCE = 16
@A5308Y
A5308Y / db_performance.rake
Created February 11, 2019 15:28
DB Query Performance demonstration webapp
# frozen_string_literal: true
namespace :db_performance do
desc 'Tests how badly written db calculations perform against ruby'
task(test: :environment) do
DBQueryPerformance.test
end
end
@A5308Y
A5308Y / onSelect.elm
Last active October 16, 2016 05:04 — forked from chalmagean/onSelect.elm
Elm onSelect decoder
-- Assuming we have a list of items in the model (type alias Model = { items : List Item }
-- where Item is a record like { id : Int, name : String }
-- The following goes in the view and generates an html dropdown.
-- In my example I get:
-- The argument to function `onSelect` is causing a mismatch.
-- Function `onSelect` is expecting the argument to be:
-- Int -> a
-- But it is:
{
"bold_folder_labels": true,
"caret_style": "blink",
"color_scheme": "Packages/User/Solarized (Light) (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"extra_file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",
Documentation:
Enabled: false
Style/IfUnlessModifier:
MaxLineLength: 100
Style/WhileUntilModifier:
MaxLineLength: 100
Style/AlignHash:
Enabled: false
Metrics/LineLength:
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@A5308Y
A5308Y / gist:4344599
Created December 20, 2012 10:54
Chef setup second try. First gist was corrupted?!
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev git-core
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@A5308Y
A5308Y / gist:4086244
Created November 16, 2012 10:28
chef setup
#!/usr/bin/env bash
apt-get -y update
apt-get -y install git-core build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install