Skip to content

Instantly share code, notes, and snippets.

View hdragomir's full-sized avatar

Horia Dragomir hdragomir

View GitHub Profile
@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@hdragomir
hdragomir / index.html
Created July 7, 2014 09:48
IIFE version of SM Font Loading
<script type="text/javascript">
(function (css_href) {
"use strict";
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
} else if (el.attachEvent) {
el.attachEvent("on" + ev, callback);
@hdragomir
hdragomir / the_classy_way_to_sudo.sh
Created February 9, 2015 19:20
The Classy Way to sudo
alias fucking='sudo '
alias doit='$(history -p !!)'