Skip to content

Instantly share code, notes, and snippets.

View gist:2f0083dbaf88155d6bdd8b0e584d4684
"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",
View restore_latest.sh
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
View vintage_cost_calculation.rb
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 Feb 11, 2019
DB Query Performance demonstration webapp
View db_performance.rake
# 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 Oct 16, 2016 — forked from chalmagean/onSelect.elm
Elm onSelect decoder
View onSelect.elm
-- 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:
View Preferences.sublime-settings
{
"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",
View rubocop.yml
Documentation:
Enabled: false
Style/IfUnlessModifier:
MaxLineLength: 100
Style/WhileUntilModifier:
MaxLineLength: 100
Style/AlignHash:
Enabled: false
Metrics/LineLength:
View capybara cheat sheet
=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 Dec 20, 2012
Chef setup second try. First gist was corrupted?!
View gist:4344599
#!/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
View gist:4086244
#!/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