Skip to content

Instantly share code, notes, and snippets.

Avatar
🕊️

Bo Jeanes bjeanes

🕊️
View GitHub Profile
@bjeanes
bjeanes / AAA_uuid_generate_v6mc.sql
Last active Jul 25, 2020
Postgres UUIDv6 (non-standard)
View AAA_uuid_generate_v6mc.sql
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- My port of https://github.com/kurttheviking/uuid-with-v6-js
-- A hacky translation of:
-- - http://gh.peabody.io/uuidv6/
-- - https://tools.ietf.org/html/draft-peabody-dispatch-new-uuid-format
CREATE OR REPLACE FUNCTION uuid_v1_to_v6(v1 uuid)
RETURNS uuid AS $$
DECLARE
v6 text;
@bjeanes
bjeanes / settings.json
Created Jun 2, 2020
Windows Terminal Settings
View settings.json
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"copyOnSelect": true,
"profiles": {
"defaults": {
"closeOnExit": true,
"cursorShape": "bar",
View mouse.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View ulid-as-uuid.rb
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@bjeanes
bjeanes / legal.css
Created Sep 11, 2018
Format legal text
View legal.css
View README.md

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

SELECT audit.audit_table('billing.subscriptions'),
       audit.audit_table('billing.customers'),
       audit.audit_table('billing.plans');
@bjeanes
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
AUTHORIZATION_TTL = 60.seconds
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
049c18da630bd3e171c38668e12933e361eea5701ace20d78b86b4725126ba3f3e89d78d5528576ea216619c3cdfc74bf5e24aae70a16a693e2be5714e862811a9
View explicit_return.rb
def explicit
return 42
rescue
:rescued
else
:else
end
def implicit
42
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:
#
You can’t perform that action at this time.