Igor Rosenberg's JS demos
This repo saves experiments in JS. The code below should be seen as sandbox futilities.
node server
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/
AJAX scroll
Test an HTTP service via GET requests. Live Version
Micro audio demo
Demo of the html tag. Live Version
Basic trigonometry
I needed some trig refreshers, for some image analysis project. So I coded some math illustrations. Live Version
Dynamic tabs
Bootstrap dynamic tabs: add a tab if missing, then delete it on click. Live Version
Using mobile camera
Use the device's image capture, crop the image, then send via XHR. Live Version
Claude's hex game
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
Clock
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
Dice run
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
element_extensions.js
Add nice functions to standard DOM elements: toggleDisplay, hasClass, addJavascript. Live Version
Image I/O
Using canvas
and <input type="file">
, extract a region from an image. Still work in progress!
Live Version
Is internet alive ?
Via a CORS request, check that a remote site can be reached. This could be the start of an SPA monitoring framework. Live Version
JQuery disable button
Simple demo of the 'disabled' attribute on a button. Live Version
JQuery rewire
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
JS playground
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
Oracle
Ask and answer questions. Live Version
sort-implem.js
As a futile exercice, rewrite a well-known sort algorithm. Live Version
Timer
Simple Countdown Timer. Live Version
xmas-tree.js
Via a long-running process, populate an array. It's a very naive basis for concurrent thinking in JS. Live Version