Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am darrenscerri on github.
  • I am scerri (https://keybase.io/scerri) on keybase.
  • I have a public key ASDFua2xlKhmQJjOVehtM2iChreaf94ztOGbLASWMLt7gAo

To claim this, I am signing this object:

@darrenscerri
darrenscerri / Middleware.js
Last active July 11, 2023 02:59
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
var Middleware = function() {};
Middleware.prototype.use = function(fn) {
var self = this;
this.go = (function(stack) {
return function(next) {
stack.call(self, function() {
fn.call(self, next.bind(self));
});
@darrenscerri
darrenscerri / cursor.js
Created February 15, 2014 13:18
Bookmarklet to add an element to the page which displays cursor coordinates
javascript:(function() {
var div = document.createElement('div');
div.style.cssText = 'position:fixed;bottom:10px;right:10px;padding: 4px 8px;border: 1px solid black;z-index:99';
document.body.appendChild(div);
document.onmousemove = function(e) {
div.innerHTML = e.clientX + ' : ' + e.clientY;
};
})();