Monitoring changes in a web application

Eric Bidelman has bundled lots of code snippets around change events that can get triggered in the browser: Changes range from simple things like DOM mutations and catching client-side errors to more complex notifications like knowing when the user’s battery is about to run out. The thing that remains constant are the ways to deal […]

jquery.unevent.js

A jQuery/Zepto plugin I’ve been using a lot lately to debounce (= attach with delay) event handlers. To be applied on scroll events for example, as you don’t want one long single scroll to pull down the performance of your webpage by constantly triggering the attached handling function. $(window).on(‘scroll’, function(e) { // update stuff *after* […]

Événement — PHP Event Dispatcher

Événement is a very simple event dispatching library for PHP. It has the same design goals as Silex and Pimple, to empower the user while staying concise and simple. Concise indeed. At the core it’s a tad above 50 lines of codes. Listening for events: $emitter->on(‘user.created’, function (User $user) use ($logger) { $logger->log(sprintf(“User ‘%s’ was […]

Object.observe()

var beingWatched = {}; function whatHappened(change) { console.log(change.name + ” was ” + change.type + ” and is now ” + change.object[change.name]); } function somethingChanged(changes) { changes.forEach(whatHappened); } Object.observe(beingWatched, somethingChanged); beingWatched.a = “foo”; // new beingWatched.a = “bar”; // updated beingWatched.a = “bar”; // no change beingWatched.b = “amazing”; // new Object.observe() lets you add […]

React: Event-driven, non-blocking I/O with PHP

Inspired upon Node.js: <?php require ‘vendor/autoload.php’; $stack = new React\Espresso\Stack(function ($request, $response) { $response->writeHead(200, array(‘Content-Type’ => ‘text/plain’)); $response->end(‘Hello World\n’); }); echo ‘Server running at http://127.0.0.1:1337’ . PHP_EOL; $stack->listen(1337); React →

on{X} – Automate your life

on{X} lets you control and extend the capabilities of your Android phone using a JavaScript API to remotely program it. Kinda like ifttt but then based on actions that happen on your mobile: an SMS being received, a location being entered/left, a change in mode of transport (from car to walking), etc. A recipe like […]