Skip to content

Instantly share code, notes, and snippets.


Bo Jeanes bjeanes

Block or report user

Report or block bjeanes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ulid-as-uuid.rb
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
bjeanes / legal.css
Created Sep 11, 2018
Format legal text
View legal.css

Install auditing on a per-table basis, e.g.:

SELECT audit.audit_table('billing.subscriptions'),
bjeanes / oauth_stub_provider.rb
Last active Feb 28, 2018
Just a set of POROs for emulating a simple OAuth2 provider
View oauth_stub_provider.rb
require 'securerandom'
module Oauth
class StubProvider
ACCESS_TTL = 1.hour
def initialize(authorization_ttl: AUTHORIZATION_TTL, access_ttl: ACCESS_TTL, **meta)
@authorization_ttl = authorization_ttl
@access_ttl = access_ttl
View genesis_public_key
View explicit_return.rb
def explicit
return 42
def implicit
View hash_intersection.rb
class Hash
# Returns a nested intersection of two Hashes.
# This draws a parallel to &/intersect on Array and Set.
# FIXME: However, those methods are not recursive, so it may make more sense
# to give this another name.
# Examples:

Postgres does not really fully support unicode the way some users might expect. Unicode (much to some people's chagrin) supports multiple ways of encoding complex characters.

For instance, the character could be:

  • ば (\u306f\u3099)
  • ば (\u3070)

Like-wise, and á are different (\u0061\u0301 and \u00e1).

bjeanes / no_new_nulls_trigger.sql
Last active Apr 10, 2017
Trigger to prevent introducing new NULL values to a list of specified columns. I'm using this because I have an 8mil-row, 100GB (with indexes) table that I can't afford to lock to add a NOT NULL constraint. This allows me to start enforcing data now, and back-fill the values without downtime. Later, when I can schedule downtime, another constrai…
View no_new_nulls_trigger.sql
* Prevent INSERTs or UPDATEs that introduce NULLs. Useful for when the
* table is too big to add NOT NULL constraints without downtime that
* can't currently be performed.
* Use like:
* ON <table>
View capybara_chrome_workaround.rb
# Chromedriver has this annoying bug where when trying to click a button or
# something which is obscured by another element due to scrolling, it fails to
# click the button or link.
# This is a workaround to always scroll the element into view after finding it.
module Capybara
module Chrome
module Finders
def find(*args)
super(*args).tap do |node|
You can’t perform that action at this time.