- ARCHIVE / 2007
- PackR won’t touch your $supers
Another quick update: PackR received an update today that means that when you use its :shrink_vars mode, it won’t minify any variables called $super. In Prototype, $super is used to implement inheritance and your class definitions will break if you change its name.
I didn’t really want to make PackR inconsistent with Dean’s original, but without [...] - Self-currying JavaScript functions
I’m telling you, this language keeps surprising me. You’ll need Prototype for this one.
Function.prototype.toSelfCurrying = function(n) {
n = n || this.length;
var method = this;
return function() {
if (arguments.length >= n) return method.apply(this, arguments);
return method.curry.apply(arguments.callee, arguments);
};
};
Make a simple function:
var adder = [...] - PackR gem now available
Update: the gem seems to be up on RubyForge now, so just gem install packr and you’re all set.
At the request of Aman Gupta (again!) PackR is now available as a gem. I’ve not got myself all set up on RubyForge yet, but in the meantime you can download the gem from my subversion repository. [...] - What are you doing with Sylvester?
Apparently some people are actually using Sylvester. Which comes as something of a surprise to me because I’ve had nobody (until today) email me or comment here about it at any length. It initially came out seven or eight months ago, and while I intented it to be a full 3D rendering environment, my day [...]
- Using ChainCollector to respond to Ajax calls
Saq made a couple of comments on my ChainCollector article about how to queue up functions to respond to Ajax calls, and whether I could write something up to shed a bit of light on how this might be done. Today, I’m going to implement some methods that allow to GET from/POST to a URL, [...]
- PackR, now with class methods
Quick note: at the suggestion of Aman Gupta, PackR now supports Packr.pack, Packr.minify and Packr.pack_file as class methods, so you don’t need to create an instance of PackR before doing anything. Originally, I wanted PackR’s design to mirror the JavaScript version to make maintainance easier, but these methods are a tiny addition so I’m happy [...]
- Methodize and functionize
Though the API docs seem to make no mention of it, there is this little gem sitting in Prototype 1.6.0:
Function.prototype.methodize = function() {
if (this._methodized) return this._methodized;
var __method = this;
return this._methodized = function() {
return __method.apply(null, [this].concat($A(arguments)));
};
};
What that does is it returns a new function [...] - Reiterate 1.3
Tiny update: after adding 16 characters (”this._object || “), Reiterate is now compatible with Prototype 1.6.0’s revised Hash API. Also, the gzipped copy is now even smaller, thanks to a different compression strategy. Essentially, when using Packer (or PackR for that matter), using ’shrink variables’ plus gzip compression will result in the smallest an fastest-to-execute [...]
- Where’s my inheritance?
Update: from what I can gather from going through the source code, $super in Prototype actually refers to the method in the parent class, rather than the old method in the current class. My point about the other libraries mentioned below stands, though. Also, my apologies to Dan, whom I cornered at @media Ajax and [...]
- JS.Class updates
Yes, it only came out a couple days ago, but it’s a 0.9.x release, so it’s still being developed. If you downloaded JS.Class over the last couple days, I strongly recommend you upgrade to the latest version.
First off, it improves performance substantially over the initial release by inspecting method definitions to find out if they [...]