Posts

javascript (and jquery) templating

I just put up some code for doing templating with javascript(and jquery). Either on the server side or on the client side. If you open the html in your browser, it runs on the client side. If you first process it server side... then it runs server side(but not on the client side). http://github.com/illume/nodejs_jquery_templating This is a followup from you are using the wrong templating language - as a proof of concept. Why is this useful? No need for a server to process the templates. Either process them server side or client side. Data can be stored in a json file. No need for a database for testing. Just create json files in a text file. Can reuse knowledge of javascript libraries (like jquery), rather than learning one of 798394 different templating languages. Can keep one html file which front end web developers can edit without them needing a new template file. Can use jquery plugins on server side too(validation, etc). Seems to work ok so far... but it still needs a lot...

Let's make a shit JavaScript interpreter! Part one.

Image
Let's make a shit javascript interpreter! Part one. As a learning exercise, I've begun writing a javascript ECMAScript interpreter in python . It doesn't even really exist yet, and when it does it will run really slowly, and not support all js features. So... let's make a "from scratch", all parsing, all dancing, shit interpreter of our very own! Teaching something is a great way to learn. Also writing things on my blog always gets good 'comments', hints, tips, plenty of heart, and outright HATE from people. All useful and entertaining :) Tokenising So to start with, we need something to turn the .js files into a list of tokens. This type of program is called a tokeniser. From some javascript like this: function i_can_has_cheezbrgr () {return 'yum';}; Into a Token list something like this: [ {"type":"name", "value":"function", "from":0, "to":8}, {"type":"n...

My javascript reading list over the last few months

Over the last few months I've been fairly deep into javascript land. Both in my full time job, and in most of my coding side projects - I've been mostly doing javascript. Of course, like most web programmers I've been dabbling in javascript over the years... but never so intensely. On the way I've been collecting a 'reading list' of videos, articles, books, and projects. Here are some of the good links from the last few months. Crockford on javascript videos: http://www.yuiblog.com/blog/ 2010/04/08/video-crockonjs-5/? utm_source=feedburner&utm_ medium=feed&utm_campaign=Feed% 3A+YahooUserInterfaceBlog+% 28Yahoo!+User+Interface+Blog% 29 akihabara arcade: http://www.kesiev.com/ akihabara/ canvas javascript games: http://www.benjoffe.com/code/ javascript 3d engine: http://github.com/mrdoob/ three.js Aves Engine: HTML/ JavaScript Game Engine ( youtube.com ) http://www.youtube.com/watch? v=Ol3qQ4CEUTo http://ajaxian.com/archives/ aves-game-e...

You are using the wrong #templating system for #html.

Use javascript + json + DOM for html templating. Front end developers know how to use this technology. They know this technology very well, so will be way productive. No weird new template language to learn and install on every single project. No dependency on a rapidly changing server side backend... or database, or 3rd party API required. No taking the html, and turning it into [$%%WEIRD TEMPLATE LANG%%$$] step. Instead you can use javascript, json and the DOM. Being able to use the templating system either via the browser, or via the server side means there is no dependency between the front end and the back end. Front end developers just need an example json file to work from. Then the back end developer just needs to create the json file. It does mean you are dependent on a DOM+javascript implementation on the server side if you want to do things like server side caching, and supporting Agents(browsers, bots etc) that do not use javascript on the client side. Just json files....

Validation through html forms.

Continuing on from a previous article I wrote earlier in the year... ' Using a html form as the model ', this post describes using validation. With html 5 comes a whole bunch of validation you can use in your forms. This makes a html form even more useful as a schema than the html 4 forms. Since you can use types like email, telephone, time, date, and such. You can also use things like minimum, and maximum length. As well as the ever useful 'required' field. You can read about html 5 forms here .

UX, rsi. ctrl+c considered harmful. If not done properly.

Ctrl+c, as well as a single handed touchpad move is considered harmful. Try and do combinations of keys, mouse moves, and gestures one finger at a time. Why? RSI. RSI hurts people. Please consider people when designing your user interfaces. Either avoid single handed moves, or warn against them. Thanks. When using computers, consider resting regularly, stopping when you hurt(and before you hurt). Also consider using one hand or finger for each action. So rather than shift+A done with one hand, try doing it with two hands. Also consider moving your hand away from qwerty middle keys do get a less stretchy press of the shift/ctrl/alt/cmd keys. Thanks. For more details on RSI, and RSI prevention, please see: http://www.rsi.deas.harvard.edu/spread.html .

better search engine

http://duckduckgo.com/