Skip to content

Instantly share code, notes, and snippets.

View mgvez's full-sized avatar

Martin Vézina mgvez

View GitHub Profile
@mgvez
mgvez / spriter.sh
Last active May 16, 2019 01:38
Uses ImageMagick to generate spritesheets with transparency
#!/bin/bash
# inspired by https://gist.github.com/968653 (https://github.com/jaymzcd)
# uses imagemagick to create spritesheets out of all the PNG images in a folder.
# There will be 2 passes done:
# - with the default tiling as determined by imagemagick
# - with the tiling optimization attempt by this script so as to leave no padding
# It seems that IM does not always produce the best optmization in regard to image size
# so compare and use the one that fits best.
# The spritesheets produced will be:
# - a PNG with transparency (32bits)
@mgvez
mgvez / jQuery.maskedSprite.js
Created November 8, 2012 20:35
jQuery plugin to transform spritesheets in Easel.js sprites
/**
jQuery maskedSprite plugin
Author: Martin Vézina 2012 http://la-grange.ca
requires :
imagesLoaded (http://github.com/desandro/imagesloaded)
easel (http://www.createjs.com)
Licensed under the MIT license
@mgvez
mgvez / jquery.abstractButton.js
Created November 20, 2012 22:05
Abstract jQuery button animation plugin
/**
A simple class to animate button rollovers with GreenSock GSAP.
Modified from its original version so as not to be loaded by require.js.
Author: Martin Vézina 2012 http://la-grange.ca
requires :
jQuery (http://jquery.com)
GSAP (http://www.greensock.com)
@mgvez
mgvez / jquery.AbstractButton.js
Created November 30, 2012 21:02
First version of a demonstration on how to create an abstract jQuery plugin. But we're not finished yet...
;(function ( $, window, document, undefined ) {
var pluginName = 'abstractButton';
var defaults = {
autoActivate : true
};
var out = function(){
@mgvez
mgvez / jquery.abstractplugin.js
Created November 30, 2012 21:13
Abstract plugin pattern
/**
A pattern for abstract jQuery plugins
Author: Martin Vézina 2012 http://la-grange.ca
Licensed under the MIT license
*/
;(function ( $, window, document, undefined ) {
@mgvez
mgvez / save-file-action.js
Created February 16, 2016 15:26
Trying to figure out the best way to send a file in chunks using Redux
//save-file action
import { CALL_API } from '../middleware/api'
const CHUNK_SIZE = 100 * 1024;
function sendChunk(dispatch, file, rangeStart = 0) {
let rangeEnd = rangeStart + CHUNK_SIZE;
if (rangeEnd > file.size) {
rangeEnd = file.size;