TypeScript, the new CoffeeScript?

Today Microsoft’s Anders Hejlsberg introduced TypeScript, which basically is a language that compiles into JavaScript, very similar to CoffeeScript. There are some differences, though: whereas CoffeeScript tries to make writing JavaScript very brief and removes lots of {}-stuff from the language, TypeScript tries to create an efficient type system on top of JavaScript. I have tried to approach CoffeeScript a couple of times, but every time using it for real has had lots of doubts: ...

October 2, 2012 · 2 min · Tero Teelahti

Element cloning problems with jQuery mobile AJAX page transitions

I’m building a site that will mainly be used with mobile browsers (> 60 %), and so I decided to build it mobile first and then adapt to desktop browser widths with CSS media queries. Natural framework choice for easy mobile development is jQuery mobile; now I’ve been playing a couple of nights with it already and mostly have liked the experience: this framework is very convention based, and at least as long as you follow the conventions everything is remarkably easy. ...

August 29, 2011 · 2 min · Tero Teelahti

JavaScript bind and curry polyfills

Although I’m a C# guy, I’ve recently really started to like JavaScript. It is so dynamic and “different” that it forces you to really think what you are doing and how do you want it structured – which is a good thing. And if you just want to get things done quick and dirty JavaScript is also a perfect match for that. When I begun to use JavaScript on daily basis I naturally soon learned to use more and more closures and all that they bring with them. For a while I wrote over and over again code like this: ...

June 28, 2011 · 2 min · Tero Teelahti

How-to localize jQuery UI Datepicker within ASP.NET MVC site

JQuery’s date picker UI component is very easy to localize on Javascript level. On this blog post I’ll describe how to ensure that date picker culture follows site’s server side culture. This is pretty trivial to accomplish, but it won’t hurt to document it here. First, you need to pick the translations you need from jQuery UI trunk. Place these files on your script folder and include them on your page (or master page), here I’m using my favorite static content bundler SquishIt to combine and minify scripts: ...

May 16, 2011 · 1 min · Tero Teelahti

Disable submit buttons on form submit with jQuery.validate and ASP.NET MVC 2

I had a very common requirement to fill: when user clicks form submit button (or enter on keyboard) the button needs to be disabled in order to prevent double submits. Double submits could of course be filtered at server side with various timestamp mechanisms, but this was not what I was after this time. The first option that came into my mind was of course just to subscribe into form submit and disable buttons there like this: ...

April 29, 2011 · 2 min · Tero Teelahti

Applying zebra striping with jQuery tablesorter and tablesorterPager plugin

A small but annoying bug I found today (and seems that someone else is having the same problem): when using jQuery.tablesorter) plugin together with tablesorterPager, applying the pager clears some properties from the table; In this case namely zebra striping. After initialization first table page is not striped, but next ones are after the first table page change. I found some crazy complex solutions, like creating new widgets to replace the built in “zebra”, but the good enough solution ended up being lot easier: asking tablesorter to reapply widget: ...

March 3, 2011 · 1 min · Tero Teelahti