This repo saves experiments in JS. The code below should be seen as sandbox futilities.
node-server.js
, a quick HTTP file server, from stackoverflow-16333790.
npm install finalhandler serve-static
cat > node-server.js
node node-server.js
firefox http://localhost:8000/
Test an HTTP service via GET requests. Live Version
Demo of the html tag. Live Version
I needed some trig refreshers, for some image analysis project. So I coded some math illustrations. Live Version
Bootstrap dynamic tabs: add a tab if missing, then delete it on click. Live Version
Use the device's image capture, crop the image, then send via XHR. Live Version
A brain-teaser: translate and rotate the pieces. Colored paths form as the pieces touch each other. Can you make 3 continuous paths: red, blue, yellow ?
Because I couldn't do it in my head, I wrote a JavaScript solver. Current version works nicely, but a complete rewrite is needed. Live Version
Just two clocks, possibly for lovers far apart. The target time zone can be set in the parameters adding ?clock1=America/New_York&clock2=Europe/Moscow The target city name can be set in the parameters adding ?city1=SpringField&city2=Moskva Live Version
A wooden brain-teaser: within a tower, four dice are inserted. They bear one of four colors on each side. The dice can be rotated in any direction. The objective is have each side of the column showing four different colors.
Because I couldn't do it in my head, I wrote a JavaScript solver. Optimizing the first naive version was fun. Live Version
Add nice functions to standard DOM elements: toggleDisplay, hasClass, addJavascript. Live Version
Using canvas
and <input type="file">
, extract a region from an image. Still work in progress!
Live Version
Via a CORS request, check that a remote site can be reached. This could be the start of an SPA monitoring framework. Live Version
Simple demo of the 'disabled' attribute on a button. Live Version
Given a server exposing HTML fragments, import them in another 'main' page via AJAX requests.
Heavily based on $.load
, which seems tailored to this exact need.
Live Version
Immediate feedback while coding in javascript : enter javascript code in the textarea, and the result of the execution is displayed below, whenever a key is pressed.
This is similar to the w3schools tryit editor or jsfiddle or any modern browser's developper "console". Live Version
An afternoon's activity: display the Mandelbrot. Live Version
Ask and answer questions. Live Version
As a futile exercice, rewrite a well-known sort algorithm. Live Version
Simple Countdown Timer. Live Version
Via a long-running process, populate an array. It's a very naive basis for concurrent thinking in JS. Live Version