Skip to content

Instantly share code, notes, and snippets.

@Made-of-Clay
Made-of-Clay / Draggable.js
Created December 9, 2015 13:44 — forked from Rob-ot/Draggable.js
Draggable and dropable views for backbone, uses html5 drag and drop api, requires jquery and underscore, not tested in IE yet
return View.extend({
initialize: function () {
this.el.attr("draggable", "true")
this.el.bind("dragstart", _.bind(this._dragStartEvent, this))
},
_dragStartEvent: function (e) {
var data
if (e.originalEvent) e = e.originalEvent
e.dataTransfer.effectAllowed = "copy" // default to copy
@Made-of-Clay
Made-of-Clay / pubsub-simple.js
Last active July 12, 2023 13:26 — forked from fatihacet/pubsub-simple.js
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book & ESM-ified
let topics = {}, subUid = -1;
// https://gist.github.com/fatihacet/1290216
export default {
subscribe(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
let token = (++subUid).toString();
topics[topic].push({
token,