Skip to content

Instantly share code, notes, and snippets.

View aarongustafson's full-sized avatar
👋
he/him/his

Aaron Gustafson aarongustafson

👋
he/him/his
View GitHub Profile
@aarongustafson
aarongustafson / responsive-iframes.css
Created October 25, 2011 17:07
Responsive iFrames with jQuery
iframe {
max-width: 100%;
}
var iterations = Math.floor(values.length / 8);
var leftover = values.length % 8;
var i = 0;
if ( leftover > 0 )
{
do {
process( values[i++] );
} while ( --leftover > 0 );
}
do {
@aarongustafson
aarongustafson / osx-special-chars.ahk
Last active June 21, 2021 15:45
AutoHotKey stuff
#UseHook
!VKC0SC029::Return ; grave -> the grave ` accent gave some probs, used the virtualkey + scancode instead
!e::Return ; acute
!i::Return ; circumflex
!t::Return ; tilde
!u::Return ; umlaut
; 1 2 3 4 5 6 7 8 9 1
; 0
; r g G a A c C t T u U
@aarongustafson
aarongustafson / basic-manifest.json
Last active January 29, 2020 00:09
Working with multi-lingual manifest files
{
"lang": "en-US",
"name": "Aaron Gustafson",
"short_name": "AaronG",
"scope": "/",
"display": "minimal-ui",
"start_url": "/",
"theme_color": "#27831B",
"description": "The online home and work of Aaron Gustafson.",
"orientation": "any",
@aarongustafson
aarongustafson / watchResize.js
Last active September 16, 2019 14:37
Efficient callback management for window.onresize
(function( window ){
window.watchResize = function( callback ){
var resizing;
callback.size = 0;
function done()
{
var curr_size = window.innerWidth;
clearTimeout( resizing );
resizing = null;
// only run on a true resize
@aarongustafson
aarongustafson / strapless.js
Last active May 12, 2019 11:05
A simple way to remove Bootstrap’s formatting and JavaScript influence
(function(){
var body = document.body,
css = document.querySelectorAll('[href*=bootstrap][href$=css]'),
css_len = css.length,
js = document.querySelectorAll('[src*=bootstrap][src$=js]'),
js_len = js.length,
xhr = new XMLHttpRequest(),
strapped = false;
@aarongustafson
aarongustafson / TinyMCE-config-HTML5.js
Created August 26, 2010 12:57
Working on a TinyMCE config that supports HTML5
// General
button_tile_map : true,
editor_selector : 'lg_mceEditor',
mode:'textareas',
theme : 'advanced',
// Cleanup/Output
apply_source_formatting : true,
convert_fonts_to_spans : true,
convert_newlines_to_brs : false,
@aarongustafson
aarongustafson / better-labels.html
Last active December 13, 2018 17:00
Code samples from my EnhanceConf 2016 talk
<label for="first_name">What’s your first name?</label>
<input name="first_name" id="first_name">
@aarongustafson
aarongustafson / backup-to-s3.sh
Created January 22, 2014 19:36
backup to S3 as a shell command (uses s3cmd)
#!/bin/bash
##
# Backup Server to S3 script
#
# Creates a local cached backup of the source folder using rsync and then
# synchronises that with Amazon S3.
#
#
# It is assumed you have rsync installed on the server.
@aarongustafson
aarongustafson / ala-audio-width-download-fallback.html
Created August 29, 2018 17:12
Audio with fallback for A List Apart
<figure id="">
<audio controls>
<source src="http://alistapart.com/d/misc-images/comment-edit.mp3" type="audio/mp3">
<source src="http://alistapart.com/d/misc-images/comment-edit.ogg" type="audio/ogg">
<!-- fall back to a simple image -->
<p>Your browser doesn't support HTML5 audio, but you can <a href="http://alistapart.com/d/misc-images/comment-edit.mp3">download the MP3</a> instead.</p>