Distractions: Micro, Spectrum and Require-Tiny

More than an hour later and I have a name, a license (MIT) and an empty repository on GitHub (♥ GitHub × 1,000,000) – how did that happen?

Firstly, I got distracted to my require-tiny “code sketch” (as coined by micmath). After my initial (non-functional – not as in requirements) brain-to-code dump, I’d joined the new amd-implement group (initially as a lurker). I’d also got AMD compliance tests that James Burke has written (this guy is serious :-) ) running against the code. So far only basic functionality is implemented and not all the tests pass (see below), but I’m confident that a fairly decent AMD loader can be delivered in 2-3k minified and gzipped (think mobile).

The failing test seems to be a problem satisfying circular dependencies. If you have a pair of modules that depend on one another, then I think the correct behaviour is that when the second define call is encountered, the implementation callback should be invoked without waiting for the first (as it will never be ready). The value that is passed in for the first module (and that available from the synchronous require that can be passed in) is the same object that will be available to the first module as its exports. Something like that anyway – I haven’t quite got to the bottom of it. Credit to James though for making tests available that exercise this behaviour (I think it’s made the difference between a throwaway prototype and something I could continue to work on). Anyway, that soaked up quite a bit of time (via bugfixes in Micro and Spectrum, to get the server I created to run the tests working).

Other than that, I made a couple of tweaks to this blog in order to get nicer URLs working (note to self: remember that you put rewrite directives in a directory block, not a virtual host – bloody Apache) and to make image uploads work (for the above).

Right, back to Yokel

Posted in Uncategorized | Leave a comment

Today’s Hacking: Running JavaScript on PHP

“Running JavaScript on PHP” – what, that’s crazy right? Well maybe it is, but I like to do crazy stuff when I’m prototyping. I want to work out the feasibility of taking a piece of JavaScript, parsing it down to an AST (probably using JS Shaper) and emitting PHP code that the performs the equivalent logic. The eventual goal would be to make it so that Spectrum.js templates could be executed on a server running PHP (>= 5.3). Let the hacking commence…

To be continued…

Posted in Hacking | 2 Comments

Welcome to my not-so-shiny new blog :-)

Well here it is: a new blog. I thought I’d start off with a blank canvas design-wise, rather than going for a theme that dozens of other people are using. It may take a while for me to get round to making it look better as I’m going to see if I can actually maintain writing regular posts (good intentions and all that). I’m using Thematic as a basis for the design of the blog, which seems a reasonable place to start although if there’s something better (semantic html 5, easy to style purely with CSS) give me a shout.

Anyway, it’s time for me to start thinking about the main subject matter of the blog rather than what it looks like and how it’s built…

Posted in Meta | Leave a comment