Archive for December, 2009

We wish you delicious Christmas*

Tuesday, December 22nd, 2009

Xmas muffin

* Winter Holidays and/or New Year’s Eve

More beautiful design by Socha

Tuesday, December 15th, 2009


ColorSpot materials by Joanna

And it’s Applicake’s friends  – Dava Palej and Greg Gorczyca  – who opened Colorspot in Krakow city center this week! What’s so special about it? Good music, great drinks and italian-swedish fusion dishes… Not to mention the fantastic interior design (also by Socha). Better quality pictures soon!

Overwriting initialize() in an existing class in Prototype

Thursday, December 10th, 2009

Recently I’ve been wondering how to overwrite the initialize() method in a class created using Prototype’s Class.create. I wanted to make multiple requests using the same Ajax.Request instance and block it from making the request automatically after it had been instantiated.

Diving in

I wanted to modify the initialize method on Ajax.Request, but did not want to modify the contents of prototype.js. The main problem was the $super argument, which is an automatic reference to the method in the parent class. Prototype documentation (http://www.prototypejs.org/learn/class-inheritance) explains it well:

When you override a method in a subclass, but still want to be able to call the original method, you will need a reference to it. You can obtain that reference by defining those methods with an extra argument in the front: $super. Prototype will detect this and make the overridden method available to you through that argument.

It is used when calling Class.create. However, it is possible to call addMethods() (which Class.create also uses) on the class we want to modify with a hash of properties that will overwrite the original methods. Consider the following example:

Ajax.Request.addMethods({
  // Overwrite the constructor, adding the autoStart option
  initialize: function($super, url, options) {
    $super(options);
    this.transport = Ajax.getTransport();
    this.original_url = url;
    if (options.autoStart !== false) this.request();
  },
  // Store the original request()
  original_request: Ajax.Request.prototype.request,
  // Allow the request to be called without the
  // argument, defaulting to the url sent
  // during initialization
  // Also, allow multiple requests from the same Ajax.Request object
  request: function(url) {
    this._complete = false;
    if (!url) url = this.original_url;
    this.original_request(url);
  }
});

What this change does is introducing a new option to the Ajax.Request constructor (autoStart) which allows us to create a new Ajax.Request object without actually calling the request. We can do it afterwards with the request() function. We can also make the request call multiple times using the same Ajax.Request instance.

(more…)

Applicake is now 3 years old!

Monday, December 7th, 2009

birthday (appli)cake

Instead of saying ‘hello’…

Thursday, December 3rd, 2009

Well, it’s been already a month since I joined the Applicake team. Instead of having said ‘hello’ at the beginning, I decided to drop a few lines after my first 30-or-so days here.

hello

So, here I am – the new PR & Office Manager at the marvelous and one-of-a-kind Applicake team :-)

It was a busy but still enjoyable month. I’ve learnt a whole lot of new things (and that’s just the beginning!) and got to know the team a bit. In terms of other accomplishments: I already have my workplace nick-name, won the first game of Pro Evolution Soccer (sorry Agata!) and learnt some office routines (e.g. when you hear someone screaming and running across the kitchen, don’t worry, that’s probably Ela who left (again!) her cup of milk in the microwave for too long ;) OR it’s Marcin being pround of whatever-that-is-he-just-coded)

Anyway, I’m really glad to be an Applicaker and hope to contribute well to the team’s culture!

And last but not least, which cake ingredient am I?

Well, except from struggling with the Applicake daily office life (e.g. there is no milk left in the fridge! Or can anyone check why there’s no electricity?) I organize a lot of stuff. I will also be the one to keep you updated on what’s up at Applicake.