Skip to content

Instantly share code, notes, and snippets.

View apartment.rb
class Apartment < Dwelling
include Holder
attr_accessor :rent
def initialize(address, rent, roommate_capacity)
super(address)
@rent = rent
set_capacity(roommate_capacity)
end
@kevlarr
kevlarr / controllers.application.js
Last active May 12, 2017
Transitioning by model
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@kevlarr
kevlarr / controllers.application.js
Created Sep 5, 2017
Testing relationships in tests
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@kevlarr
kevlarr / README.md
Last active Oct 9, 2017
Data transitions in D3 version 4
View README.md

There is an excellent example of transitioning data in D3, but this only works in version 3.

D3 version 4 requires a slightly different approach, namely that the entered selections need to be merged prior to transition.

Added transition on exit. Also did a little code cleanup, especially given that eval is pretty gross.

@kevlarr
kevlarr / .psqlrc
Last active Nov 8, 2019
psql config
View .psqlrc
\set QUIET 1
-- Don't page output that's bigger than screen,
-- because scrolling is a thing that works
\pset pager off
-- Auto-expand when too much data for table view
\x auto
-- Make null pretty
View cognito_auth.py
"""
See:
https://aws.amazon.com/premiumsupport/knowledge-center/decode-verify-cognito-json-token/
https://medium.com/datadriveninvestor/jwt-authentication-with-fastapi-and-aws-cognito-1333f7f2729e
"""
from datetime import datetime
import logging
from os import environ
import re
from typing import Any, Dict, List, Optional