Skip to content

Instantly share code, notes, and snippets.

Avatar

Jahfer Husain jahfer

View GitHub Profile
@jahfer
jahfer / active_record_test_logger.rb
Last active Nov 26, 2019
Small tweak to output Active Record logs inside of a test with the stacktrace attached
View active_record_test_logger.rb
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
View keybase.md

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:

View dynamic_font_loading.js
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;
View election_notes.md

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 Aug 29, 2015
Messing with ES6 Map + Generator
View generator-to-map.js
const ENDKEY = Symbol('endOfMap');
function* simpleGen() {
let counter = 0
while (counter++ < 3) {
yield [counter, true]
}
yield [ENDKEY, false]
}
@jahfer
jahfer / init.el
Last active Aug 29, 2015
Emacs config
View init.el
;; 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)
View init.el
;; 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)
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAwHAzE57c+wKwpM/zZvuDFEYm9TQ+U7NcCwj2UHFupYWUEgf3sX/LU2H6VwbdJR0Xcgfr8GrrOiJha5gl+RkCEtfEYjcqw8uoO3plY+wAcJQwXeTYkP5Z21LDCE0E3cKcH9rRtA6J6i8QDrCNzi7rCSgm0kdubZfcJNZ/YICFPDGJEcfdElV1FNzABB85jDuvoVjP0vEPOZy3tG67YT9GcN8RfgkJmGCPRdgKHl7tYHxELANRlXf+7QawcosH9L7GoQOpi9nia5wYMCGV3NhGcwKdDmxWgLhmYD/smGOaEGh/Dt9i9DD9QMZ6gOF1/9OX5SrKzab2rYo6L+YBNs5V jahfer@github.com
View dropbox2gifwit.go
package main
import (
"encoding/json"
"io/ioutil"
"flag"
"strings"
"fmt"
)
@jahfer
jahfer / pubsub.swift
Created Jun 3, 2014
Simple pubsub implementation in Swift
View pubsub.swift
// =====================================================
enum LogLevel: Int {
case Debug = 1, Info, Error
}
let log_level = LogLevel.Debug
protocol Loggable {
func log()
You can’t perform that action at this time.