John Cox

Blogs · @wyome · Now · Shelf

Interesting

Write Better JavaScript with Promises

A beginner-oriented case for using jQuery's promise objects instead of plain callbacks, built around fetching lorem ipsum from the HipsterJesus API. It argues promises read more clearly (separate done/fail/always handlers), make better APIs (a method can return a promise rather than take a callback), allow chaining via `then` to build small data-transforming methods like html, paragraphs and sentences, and simplify coordinating parallel requests with `$.when` versus manual flag-checking. It also notes the since-deprecated Angular feature of binding templates directly to promises, and flags that jQuery's Deferred differs subtly from the Promises/A+ standard.

Permalink

Label and name inputs properly — Web Fundamentals

The saved text is almost entirely web.dev's navigation and footer (Resources, Baseline, Blog, topic links like AI, Privacy, Accessibility, Forms, plus Contribute and Follow links), with only a one-line blurb for a course about HTML forms. No actual article body came through, so there is no argument or reporting to recover. It's worth re-saving from the original page, since the only hint of content is that it sits in web.dev's HTML forms course.

Permalink

heatmap.js | Dynamic Heatmaps for the Web

This is the landing page for heatmap.js, a JavaScript library for drawing dynamic heatmaps in the browser. It pitches the 2.0 release as faster (new rendering module), able to handle 40k+ datapoints, easier to use and extend, all at about 3kB gzipped. It shows a short setup example (create a heatmap on a container, then feed it x/y/value points), and points to documentation, community plugins (especially for GIS work), user testimonials, and showcases. It also says the library only renders data you supply and doesn't track visitor behavior, and it steers people wanting tracking toward paid heatmap analytics partners.

Permalink

Untitled (http://vyasrao.github.io/tAutocomplete/)

Documentation for tautocomplete, a jQuery plugin that turns autocomplete results into a multi-column table rather than a single-line list, so related fields like country, code and capital appear side by side. It covers setup, the settings (column names, hidden columns, themes, search-word highlighting, delay, regex input filtering), callbacks for local or Ajax data, and getter methods for the selected row's id, text and full record. It also lists known gaps: it isn't mobile friendly, and the dropdown shows only 15 rows with no scrollbar.

Permalink

appear.js

appear.js is a dependency-free JavaScript library that watches a set of DOM elements and runs your callbacks when they scroll into or out of the viewport. You call `appear()` with a config object: a function or collection supplying the elements, `appear` and `disappear` handlers, an optional `reappear` flag for repeated tracking, and a `bounds` pixel buffer so elements count as visible before they actually enter the view. Scroll and resize checks are debounced (50ms by default), with extra tuning options (`deltaSpeed`, `deltaTimeout`) to catch slow continuous scrolling. The returned object offers `trigger`, `pause`, `resume`, and `destroy`, and the project's showcase demo is a lazy image loader built on it.

Permalink

Swift Access Control - Private, Internal and Public [iOS developer:tips];

The saved page is a placeholder for iosdevelopertips.com, which now presents itself as a community-first non-profit still in development rather than the iOS programming resource the domain name suggests. It lists planned work (volunteer food and essentials distribution, skill-building and livelihood training, safe spaces for youth and seniors) and invites visitors to volunteer, partner, or stay updated while it prepares governance and safeguards. There is no article content or technical material here, so it is worth keeping only as evidence that the domain changed hands or purpose.

Permalink

AjaxQ jQuery Plugin

AjaxQ is a roughly 600-byte jQuery plugin that runs ajax requests one after another by swapping `$.ajax(opts)` for `$.ajaxq(name, opts)`, with `$.postq` and `$.getq` as equivalents for `$.post` and `$.get`. Requests sharing a queue name run sequentially, while differently named queues run in parallel, and each call returns a promise matching `$.ajax`'s return type. It also offers helpers to check whether a queue is running (`isRunning`), grab the active jqXHR (`getActiveRequest`), clear pending items without stopping the current one (`clear`), or abort the current request and empty the queue (`abort`). It can take a function that supplies request options at dequeue time. It's from Foliotek, MIT-licensed, installable via bower, and comes with a demo and Mocha tests.

Permalink

Dense.js — Serve retina images

Documentation for Dense, a jQuery plugin by Jukka Svahn that swaps in higher-resolution images based on the device's pixel ratio. It works by calling `$('img').dense()` or adding a `dense-retina` class to the body. Retina paths are derived by appending a `_2x`-style suffix to the src unless `data-nx` attributes are set. It supports jQuery 1.7 and later and loads as an AMD module, and it has limited, unrecommended Zepto 1.0.0 support that requires extra modules.

Permalink

A JavaScript Constructor Problem, and Three Solutions

Forgetting `new` when calling a JavaScript constructor silently returns undefined and pollutes the global scope, and `"use strict"` only partly helps, since it throws only when you assign to `this`. The post walks through three fixes: auto-instantiation (from Herman's *Effective JavaScript*), which detects a missing `new` and creates the instance itself, making constructors composable with decorators like a logging wrapper, though it's a leaky abstraction. The second overloads the constructor as an `instanceof` predicate, handy for filters. The third, from Olivier Scherrer, simply throws an error on a missing `new`, optionally pairing it with a separate `Fubar.is` method for the type check.

Permalink

The Simpsons in CSS

What's saved here looks like the scraped remains of a CSS art demo: a gallery of Simpsons characters (Homer, Bart, Marge, Lisa, Maggie, Mr Burns, Ned Flanders, Krusty, Itchy, Smithers, Comic Book Guy, Ralph, Apu), each drawn in pure CSS and paired with a "View CSS" link to its stylesheet. Near the end the author remarks that having built the characters this way lets them do things like recolour them, shown with "Green Bart" and "Colourless Bart" variants. The captured text contains no real prose or argument, so the value was likely the technique itself, drawing recognisable cartoon figures with stylesheets and restyling them by swapping CSS.

Permalink

Promises in PHP

Evert Pot announces sabre/event 2.0, whose main addition is Promise support for PHP. He admits promises are rarely needed in a language with no real event loop, and says it took him a long time to understand them well enough to implement one. The motivation was a web service client that had to make many HTTP requests for many users, with some requests needing a strict order and others able to run in parallel. He fit the whole concept into one fairly simple class, though debugging it took a lot of step-through work, and he points to the library's website for full documentation.

Permalink

PNotify

This is the demo page for PNotify's optional modules, a JavaScript notification library, with an interactive example for each. The Desktop module shows notices outside the browser window (after asking permission, and falling back to in-page notices if denied), Mobile makes them work on phones and tablets, and Countdown, Animate (via Animate.css effects), Confirm dialogs and prompts, and Paginate (which works best with one visible notice, destroy on, and modalish off) round out the set. A Reference module is included as a template for anyone writing their own module.

Permalink