C’mon Mr Speaker, stop re-writing your “distance” function every project… Math.hypot() has been around for ages now! Math.hypot(1,1); // 1.4142135623730951 (So has Math.SQRT2. I also forgot I already remembered and re-forgot that)
Category: Javascript
And… goodbye JavaScript!
When I de-bloated my piece of the web, I noted that the largest asset I was serving on my blog was a local version of jQuery – coming in at some 70+ kilobytes – that “I still need to insert into the head of my page for historical reasons: 15 years ago I in-lined lots […]
JavaScript’s Numeric Separators
During a particularly-late night coding session, I accidentally discovered that JavaScript now has “numeric separators”. What started as a simple test in my browser console: `dx=100+xo`, would be drailed by a typographical error that revealed a hidden secret… `dx=100_` As I depressed the underscore-instead-of-plus key, Firefox’s auto-evaluator-thingy sprang into action and warned: “Uncaught SyntaxError: underscore […]
document.designMode?
You learn something new every day. Today I learned about insect reproductive systems, and also that document.designMode is a thing. Both seemed pretty interesting, but only the latter let’s you make any text on any web site “editable”. Open up the dev console and type document.designMode=”on”, and marvel as you can type over any text […]
Where the ECMA 262 1st Edition did they come from?
Following on from my recent blog post “Where the HTML4.0 did they come from” (October 2005)… I just found two native JavaScript constants that I have hardcoded *at least* 100 times over the years: I guess I should be forgiven for not knowing about them yet, they’ve only been there since 1997.
Me n’ Carl Sagan hand-rolling some WebGL2
Imagine, if you may, an apple sitting happily on your desk. One day, and in a manner causing much confusion to our apple friend – you wrote some weird WebGL2 thing from scratch. From the apple’s perspective, it might look something like this. However, from a source code’s point of view it would look more […]
ES6 (ES2017+) module support
It’s been a long time coming, and we’re still on shaky ground – but native module support is close. Not “burn your build tools!” close, but “burn your build tools for personal projects!” close… like arrow function syntax in 2013. If you have Firefox Nightly, or Safari Tech Preview (or Edge, I believe!) – you […]
Building geometry with fraggles
My last experiment got out of hand and now the cubes have become self aware. See for yourself! The earlier “lil cube” example worked by creating individual box meshes and adding them to the scene. This is not a very scalable approach if we want a lot of boxes! Creating a single chunk of 16 […]
Lil’ cube-y thing
Just adding something before the new year. Gotta get those posting stats up. Lil’ cube-t thing! Made with three.js, quick-sticks. Source of course.