Skip to content

Instantly share code, notes, and snippets.

@jahfer
jahfer / active_record_test_logger.rb
Last active November 26, 2019 14:34
Small tweak to output Active Record logs inside of a test with the stacktrace attached
module MyLogSubscriber
def sql(*args)
trace = caller
Rails.backtrace_cleaner.remove_silencers!
Rails.backtrace_cleaner.add_silencer { |line| not line =~ /^(components)\// }
puts Rails.backtrace_cleaner.clean(trace)
super
puts "---------------"
end
end

Keybase proof

I hereby claim:

  • I am jahfer on github.
  • I am jahfer (https://keybase.io/jahfer) on keybase.
  • I have a public key whose fingerprint is 989C AA71 4413 EC42 E630 D847 EA0E 7143 55D3 C19E

To claim this, I am signing this object:

function loadFontStyles() {
if (!window.localStorage) { return; }
var cssText;
if (cssText = localStorage.getItem('font-style-cache')) {
injectFontCSS(cssText);
} else {
fetch('/css/fonts.css').then(function(cssText) {
localStorage.setItem('font-style-cache', cssText);
return cssText;

Election 42 Notes

Child-care

  • NDP :: National $15/day daycare + keep Universal Child Care Benefit from Conservatives
  • Conservatives :: Universal Child Care Benefit (taxable)
  • Liberals :: Canada Child Benefit (non-taxable)

Senate

  • NDP :: Abolish
  • Conservatives :: No new appointments, let provinces deal with it
  • Liberals :: Reform
@jahfer
jahfer / generator-to-map.js
Last active August 29, 2015 14:14
Messing with ES6 Map + Generator
const ENDKEY = Symbol('endOfMap');
function* simpleGen() {
let counter = 0
while (counter++ < 3) {
yield [counter, true]
}
yield [ENDKEY, false]
}
@jahfer
jahfer / init.el
Last active August 29, 2015 14:09
Emacs config
;; Package
;; Managing extensions for Emacs is simplified using =package= which
;; is built in to Emacs 24 and newer. To load downloaded packages we
;; need to initialize =package=.
(require 'package)
(setq package-enable-at-startup nil)
(package-initialize)
@jahfer
jahfer / init.el
Created September 15, 2014 16:49
;; Package
;; Managing extensions for Emacs is simplified using =package= which
;; is built in to Emacs 24 and newer. To load downloaded packages we
;; need to initialize =package=.
(require 'package)
(setq package-enable-at-startup nil)
(package-initialize)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAwHAzE57c+wKwpM/zZvuDFEYm9TQ+U7NcCwj2UHFupYWUEgf3sX/LU2H6VwbdJR0Xcgfr8GrrOiJha5gl+RkCEtfEYjcqw8uoO3plY+wAcJQwXeTYkP5Z21LDCE0E3cKcH9rRtA6J6i8QDrCNzi7rCSgm0kdubZfcJNZ/YICFPDGJEcfdElV1FNzABB85jDuvoVjP0vEPOZy3tG67YT9GcN8RfgkJmGCPRdgKHl7tYHxELANRlXf+7QawcosH9L7GoQOpi9nia5wYMCGV3NhGcwKdDmxWgLhmYD/smGOaEGh/Dt9i9DD9QMZ6gOF1/9OX5SrKzab2rYo6L+YBNs5V jahfer@github.com
package main
import (
"encoding/json"
"io/ioutil"
"flag"
"strings"
"fmt"
)
@jahfer
jahfer / pubsub.swift
Created June 3, 2014 02:45
Simple pubsub implementation in Swift
// =====================================================
enum LogLevel: Int {
case Debug = 1, Info, Error
}
let log_level = LogLevel.Debug
protocol Loggable {
func log()