thomasfrank.se
What's up?
On this web site I write about stuff that interests me, predominantly in the client side web development area -- JavaScript, JSON, CSS, usability, design.
July 4, 2011
A CoffeeScript compiler/development tool for LAMP that does not require node.js
CoffeeMaker - compiles your CoffeeScript scripts clientside and caches them on the serverside with no need for a node.js installation. Also provides an include command.
June 1, 2010
SQLike is a small (10 kB) query engine for JavaScript and ActionScript. Its functionality and syntax is similar to that of SQL and it can be used to query arrays of objects or arrays of arrays. The purpose of SQLike is to provide a tool for this approach that can be used on the clientside in all browsers. Start querying your arrays today.
May 16, 2010
This simple little script checks how long it takes to run intervalled functions and then adjusts the intervals if needed, according to how many percent of total application time you are willing to spare. Optimize your intervals today.
May 16, 2008
When you right click a link and choose to open it in a new tab or a new window, it would be nice if the old window would get referenced in the window.opener property. That would give the new window access to the JavaScript and DOM objects from the old window. This happens in IE and Opera, but not in Firefox and Safari. Here's a fix that hopefully will make it work in those browsers as well.
May 14, 2008
This test tries to evaluate to what extent you’re familiar with some basic concepts and syntax in JavaScript. Suprisingly enough it seems really hard for some people to complete. That is why I have decided to publish it here. Have fun with it. Please comment on it: Could a person fail this test and still be really good at JavaScript?
January 20, 2008
I've made a small script that let you use JavaScript session variables without using cookies. It will let you store 2 MB of data, with much less hassle than a cookie based solution. Try it out here.
July 5, 2007
The last couple of weeks I've been searching for a good JSON editor with a tree view. One that allows you to get a good overview of a JSON structure and make changes to it easily.
Yes, I know there's something a bit like that in Firebug (my favourite bug pesticide) and I did actually find a rather promising attempt by Calm_Pear. But I felt neither of these were close enough to home, so finally I went ahead and wrote my own JSON editor.
Februari 14, 2007
Here's a script optimized to make form input undoable/redoable. It's really simply to apply to any form.
Januari 29, 2007
A while ago I was writing one of those pesky JavaScript driven webapps where there's a whole lot of undoing going on. The user changes his mind a wants to get back to a previous state -- and the poor programmer has to accommodate. So I was thinking to myself, whilst bumping the back of my head against the stairs (bump, bump, bump): Wouldn't it be nice if I could get a js object to remember its last state and the state before that and so on?
Januari 23, 2007
I confess - I used to loop through my MySQL queries, in my server side language of choice, to build JSON. But there is a far better way that will save you some coding, add to simplicity and might even save some valuable server time.
If you're running MySQL 4.1 or later you can use the nifty function GROUP_CONCAT() together with the normal CONCAT() function to build all your JSON straight from your SQL query.
Januari 23, 2007
So you say you want to make remote procedure calls with ease from your web page. Here's an easy way to
get some more javascript functions on your page as they are needed or get som data fragments (JSON?) back from the server.
Let's include some js.
September 20, 2006
One of the projects I'm working on right now involves a lot of form input. So I have come up with a small script to control what a user can write in a text/textarea field.
It allows us to control what characters the user is allowed to enter. Have a look.
August 31, 2006
I'm back with a more basic, memory efficient and ten times as small script, with a nice prototypal inheritance pattern. And I steer clear of the Object.prototype too.
To good to be true?
August 25, 2006
Does "if… else if… else if… else" sound familiar to you?
I bet it does – it is probably one of the most used structures in programming. But did you know that there are at least two alternatives to it in JavaScript?
Let us take a closer look at the conditional operator and the inner workings of the logical and/or operators -- for a leaner & meaner code.
July 29, 2006
So you have this nice array of objects -- much like a database table -- in JavaScript, but JavaScript's built in array method sort() only works on arrays of strings. How do you sort your objects? Let's sort it out...
July 20, 2006
We have seen color gradiented backgrounds on the web for some time now. But here's a new effect for you -- color gradiented text.
I've made a small script (3 kB) that lets you use gradients on your text. It is unobtrusive and really simply to use, no images needed. Check it out.
July 19, 2006
To collect your client side JavaScript objects and store or manipulate them server side (or just have a good look at them while debugging) you need a JSON stringifier. It translates your object structure into a string that can be evaluated back to the original object. Recently I taught my old stringifier some new exciting tricks -- like how to handle circular references. Have a look at my interactive example.
July 13, 2006
I heard that extending the JavaScript Object.prototype is verboten. Now, this does not go well with my lazy attitude to programming. But neither does the extra checks needed in your for-in-loops if you extend it. Here's my lazy solution.
July 4, 2006
The hyperlinks you create in FlashPaper, via Word, can only point to different web sites. Wouldn't it be nice to be able to point to internal Flash functions as well? Having a link that says "start this part of the program" that really works? I think it would, so I've modified Flashpaper's API slightly.
June 25, 2006
Experienced JavaScripters often say that you should not clutter the global namespace. So it would be nice to know just how cluttered your global namespace is, wouldn't it? But finding all the variables in your global namespace used to be hard, especially in Internet Explorer. Now I'm making it easy for you.
June 9, 2006
JSON objects are singleton objects by design, not by choice, since they have no constructor. I really like JSON, but I like classes too. Therefore I have written freeware library called classyJSON. It's small and it's free -- so now there's no excuse not to learn how to give your JSON some class.
June 9, 2006
Opera, Safari and Firefox 1.5 don't trigger the onload event when you hit the back button. This is not a bug -- it is "by design". How do we deal with that? Let me show you a nifty little workaround.
June 8, 2006
A while ago I wrote an XML to JSON converter in JavaScript. Give it a spin and see what you think.