- ARCHIVE / JavaScript
- Automated example code displays
I’ve been writing some code examples for some of the UI components I’m writing for Ojay, and I need to display the implementation code and stylesheet on the page. Pretty standard fare: here’s a UI example, and here’s the code you need to implement it. Easy.
Trouble is, I don’t want to duplicate the code (once [...] - Composing DSLs in JavaScript
Further to my previous post I thought I’d share the approach I’ve been using to compose DSLs in JavaScript. If you want a more involved example, check out the currently in-development Forms module for Ojay.
For this example I’m going to be writing a simple permissions language that sets up rules about when certain methods may [...] - With a little help from with
You know the old saying:
with (JavaScript) {
metaprogramming.is(’possible’);
}
I’m going to leave the discussion of what constitutes metaprogramming to another day (read: never), but what I will say is that I’m becoming more interested in DSLs and fluent interfaces. I want the code I write to work at a very high level, where [...] - JS.Class 1.5 is now out
Hot on the heels of Ojay comes a new release of JS.Class, my Ruby-inspired JavaScript library for class-based OOP. Ojay is itself based on JS.Class, and has influenced the design of some of its new features. There has been one small change to the 1.0 API, and a stack of additional modules added in; it’s [...]
- Announcing Ojay, the nice way to use YUI
I’ve been wanting to talk about this project for weeks if not months, and now I finally can. the OTHER media (the web shop I work for) is open-sourcing Ojay, a project I’ve been developing on-and-off since I started at the company back in October. It’s a wrapper for the core DOM, event, animation and [...]
- How to help your users out as a library designer
Seems my functional posts have been generating an obscene amount of traffic lately (thank you, Reg). In which spirit, here’s a little suggestion for anyone designing a JavaScript library.
I was reading about Oliver Steele’s MIT-licensed Functional library earlier, and came across this little gem (modified slightly to my whims):
/**
* Returns a function identical to [...] - IE drops file uploads on the floor
On top of the whole X-UA-Compatible (for some obscure value of Compatible) debacle, last week gave me one more reason to hate Internet Explorer: the way it handles injection of file upload fields into the document. I was writing some code to allow an arbitrary number of files to be uploaded, one by one, through [...]
- Bringing “static” type-checking to JavaScript
It looks like my language to learn for this year is Java. Last year (well, tail end of 2006) is was Ruby and Rails, and I’m very much still learning as far as those are concerned. I also got heavily into JavaScript; I’d done a little jQuery before but 2007 was the year I really [...]
- Deriving the Y combinator
Before I start in on this: be aware I’m mostly writing this to force myself to understand something by writing it down. If you get anything out of it, consider it a bonus. I will be deriving Y() in JavaScrpit, and giving a version in Ruby.
After stumbling on this article on Raganwald last year (thoroughly [...] - Announcing Holly
After some discussion at work about how to manage JavaScript dependencies in our CMS, I decided to write a quick Rails plugin for doing just that. It’s called Holly, and it lets you use special comments inside script and CSS files to declare their dependencies. Whenever you use javascript_include_tag or stylesheet_link_tag, Holly inspects the dependencies [...]