Skip to content

Instantly share code, notes, and snippets.

Aaron Gustafson aarongustafson

Block or report user

Report or block aarongustafson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aarongustafson
aarongustafson / strapless.js
Last active May 12, 2019
A simple way to remove Bootstrap’s formatting and JavaScript influence
View strapless.js
(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 / watchResize.js
Last active Apr 28, 2019
Efficient callback management for window.onresize
View watchResize.js
(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 / TinyMCE-config-HTML5.js
Created Aug 26, 2010
Working on a TinyMCE config that supports HTML5
View TinyMCE-config-HTML5.js
// 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 Dec 13, 2018
Code samples from my EnhanceConf 2016 talk
View better-labels.html
<label for="first_name">What’s your first name?</label>
<input name="first_name" id="first_name">
@aarongustafson
aarongustafson / backup-to-s3.sh
Created Jan 22, 2014
backup to S3 as a shell command (uses s3cmd)
View backup-to-s3.sh
#!/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.
View osx-special-chars.ahk
#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
View ala-audio-width-download-fallback.html
<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>
View backup-to-git.sh
#!/bin/bash
##
# MySQL DB dump to Git commit
#
# Dumps the specified mysql database to the given location and commits it and
# the previous database to the Git repository.
#
# It is assumed you have already setup the Git respository to only be the
# a checkout of the database backup location
View duffs-device-improved.js
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 / responsive-iframes.css
Created Oct 25, 2011
Responsive iFrames with jQuery
View responsive-iframes.css
iframe {
max-width: 100%;
}
You can’t perform that action at this time.