Skip to content

Instantly share code, notes, and snippets.

View JWally's full-sized avatar

Justin Wolcott JWally

  • Dallas, Texas, United States
View GitHub Profile
define(function(){
var instance = null;
function MySingleton(){
if(instance !== null){
throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()");
}
this.initialize();
}
@JWally
JWally / ExampleFileMD5.js
Last active July 17, 2023 20:23
Simple Method to Calculate the Hash of a file in Javascript using HTML5 API
//Event Listener tied to the file input field
document.getElementById('attachment').addEventListener('change', eventHandler, false)
/**
*Description: Simple method to handle an event
*and fire off a function
**/
function eventHandler(evt){
var file = evt.target.files[0];
fileHash( file, md5, function(x){