Skip to content

Instantly share code, notes, and snippets.

View kkleidal's full-sized avatar

Ken Leidal kkleidal

  • Genesis Therapeutics
  • Boston, MA
View GitHub Profile
@kkleidal
kkleidal / client.py
Created October 24, 2014 20:21
PyZMQ Basic Pub/Sub Interaction
import zmq
protocol = "tcp"
host = "tidmarsh.media.mit.edu"
port = "1305"
host = "127.0.0.1"
port = "5556"
# Socket to talk to server
@kkleidal
kkleidal / jquery.file.upload.js
Created August 5, 2014 22:42
jQuery AJAX File Upload
(function ($) {
var oldUpload = $.fn.upload;
jQuery.fn.upload = function( options ) {
if ( this.prop('tagName') !== "INPUT" || this.attr('type') !== 'file' ) {
throw new Error("Cannot call upload function for given element type. Only works for <input type='file' />");
}
var files = this.prop('files');
var defaultCallback = function() { };