Skip to content

Instantly share code, notes, and snippets.

View dkubb's full-sized avatar
🏠
Working from home

Dan Kubb dkubb

🏠
Working from home
  • Betterment
  • Mission, BC, Canada
  • X @dkubb
View GitHub Profile
@dkubb
dkubb / git-remove-merged.sh
Last active March 8, 2023 17:24 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
git remote update &&
git remote prune origin &&
git branch -r --merged origin/master |
awk -F"/" '!/(>|master)/ {print $2}' |
xargs -rL1 git push origin --delete
@dkubb
dkubb / .gitignore
Created December 5, 2011 18:26
Test Feedzirra w/VCR using an HTTP proxy
cassettes
### Keybase proof
I hereby claim:
* I am dkubb on github.
* I am dkubb (https://keybase.io/dkubb) on keybase.
* I have a public key ASABdYDarQ43GiNGY274zzSheBhF9a6SCfzdVInw3nb_ogo
To claim this, I am signing this object:
@dkubb
dkubb / eager_repository.rb
Last active May 13, 2019 21:10
Eager Loading DataMapper Associations
require 'memoist'
# Usage:
#
# customers = Customer.preload(Customer.orders.line_items.item)
#
# customers.each do |customer|
# customer.orders.each do |order|
# order.line_items.each do |line_item|
# line_item.item # yay, no more N+1, only 4 queries executed !
@dkubb
dkubb / ssl.nginxconf
Last active April 11, 2019 03:56
Nginx SSL configuration (PFS, HSTS, SPDY, BREACH mitigation, FIPS compliant)
ssl_certificate cert.pem;
ssl_certificate_key cert.key.pem;
ssl_trusted_certificate cert.ca.pem;
ssl_dhparam cert.dh.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers FIPS@STRENGTH:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
@dkubb
dkubb / ev.rb
Created March 16, 2011 22:13
Poor-man's Embedded Value
class User
include DataMapper::Resource
property :id, Serial
property :username, String, :required => true, :unique => true
property :address_street_address, String
property :address_location, String
property :address_subdivision, String
property :address_country, String
I am pleased to announce the release of DataMapper 0.10.0 Release Candidate 1.
For the impatient, here are the command line instructions to install it:
Install
-------
1) Add gems.datamapper.org as a gem source:
gem sources --add http://gems.datamapper.org
@dkubb
dkubb / money.rb
Last active January 13, 2017 01:39
A modern ruby Money class
require 'bigdecimal'
require 'bigdecimal/util'
require 'rubygems'
require 'adamantium'
require 'concord'
class Money
include Adamantium, Concord.new(:amount), Comparable
module EnumerableExtensions
# An exception raised when an invalid number of entries is returned
class InvalidCountError < StandardError
# Initialize an exception to report an invalid enumerable count
#
# @param expectation [String]
# @param entries [Array]
#
@dkubb
dkubb / axiom-mutant-coverage.txt
Last active December 27, 2015 08:09
Mutant Coverage for Axiom
Subjects: 440
Mutations: 8541
Kills: 8541
Runtime: 3773.23s
Killtime: 3670.90s
Overhead: 2.71%
Coverage: 100.00%
Alive: 0