Skip to content

Instantly share code, notes, and snippets.

View extralam's full-sized avatar
🎯
Focusing

Alan Lam extralam

🎯
Focusing
View GitHub Profile
@fquarters
fquarters / gist:5455460
Last active March 26, 2016 10:17
This plugin is dead simple. It takes your large image and gives you back a proportionally downscaled one as a dataURL object. Works fine in both Chrome and Firefox, not so fine in Opera (‘onload’ event doesn’t fire as it should and I have no idea why, seems to be a “known bug”), and doesn’t work in IE (it may work in IE10 though, but I couldn’t …
var Resizer = function() {
var maxWidth = 0, maxHeight = 0;
var canvas = document.createElement('canvas');
var img = new Image();
var callback;
var isFileOk = function(file) {
if (!file || !file.type.match(/image.*/)) {
return false;
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@guybedford
guybedford / jquery.ajaxqueue.js
Created April 23, 2012 12:12
jQuery AJAX queues
/*
Allows for ajax requests to be run synchronously in a queue
Usage::
var queue = new $.AjaxQueue();
queue.add({
url: 'url',