javascript

37 posts tagged “javascript”.

  1. 2024
  2. Using Tesseract.js to OCR every image on a page

    Pasting this code into a DevTools console should load Tesseract.js from a CDN, loop through every image loaded by that page (every PNG, GIF, JPG or JPEG), run OCR on them and output the result to the…

    1 min read
  3. Calculating the AQI based on the Purple Air API for a sensor

    Purple Air sensors have an API at , which returns JSON that looks something like this: There's just one problem with this: it doesn't give you the AQI number that is displayed on their site!

    1 min read
  4. Loading lit from Skypack

    Lit 2 stable was released today, offering a tiny, feature-full framework for constructing web components using modern JavaScript.

    1 min read
  5. Converting HTML and rich-text to Markdown

    If you copy and paste from a web page - including a full table - into a GitHub issue comment GitHub converts it to the corresponding Markdown for you. Really quick way to construct Markdown tables.

    1 min read
  6. JavaScript date objects

    A few notes on JavaScript object, based on trying to do some basic things with them in Observable notebooks.

    1 min read
  7. 2023
  8. Display EC2 instance costs per month

    The EC2 pricing page shows cost per hour, which is pretty much useless. I want cost per month. The following JavaScript, pasted into the browser developer console, modifies the page to show…

    1 min read
  9. Scroll page to form if there are errors

    For a Django application I'm working on (this issue) I have a form that can be quite a long way down the page.

    1 min read
  10. HTML datalist

    A Datasette feature suggestion concerning autocomplete against a list of known values inspired me to learn how to use the HTML element (see MDN).

    1 min read
  11. Annotated code for a demo of WebSocket chat in Deno Deploy

    Deno Deploy is a hosted Deno service that promises a multi-tenant JavaScript engine running in 25 data centers across the world.

    1 min read
  12. GitHub OAuth for a static site using Cloudflare Workers

    My tools.simonwillison.net site is a growing collection of small HTML and JavaScript applications hosted as static files on GitHub Pages.

    6 min read
  13. Histogram with tooltips in Observable Plot

    Given an array of datetime objects, I wanted to plot a histogram. But I wanted to automatically pick a bucket size for that histogram that resulted in something interesting, no matter what range of…

    1 min read
  14. Deno KV

    Initial article: April 28th 2023 - see below for an update I got intrigued by Deno KV, which describes itself as "a global database for global apps".

    4 min read
  15. Using packages from JSR with esbuild

    JSR is a brand new package repository for "modern JavaScript and TypeScript", launched on March 1st by the Deno team as a new alternative to npm My JavaScript ecosystem fluency isn't great, so it took…

    3 min read
  16. Downloading every video for a TikTok account

    TikTok may or may not be banned in the USA within the next 24 hours or so. Here's a pattern you can use to download all of the videos from a specific account.

    2 min read
  17. Annotated package.json for idb-keyval

    Jake Archibald pointed to his for as a "modernish example" of NPM packaging on Twitter this morning. I've been frustrated at my lack of understanding of for too long, so I decided to do some research…

    1 min read
  18. Preventing double form submissions with JavaScript

    I needed this for VIAL issue 722. I decided to disable form submissions for two seconds after they are submitted, to protect against accidental double submissions without risk of unexpected issues…

    1 min read
  19. Configuring auto-update for an Electron app

    This is almost really simple. I used electron/update-electron-app for it, the instructions for which are: - Add it to with - Make sure your field in that file points to your GitHub repository - Use…

    1 min read