Archive for category Webas

Internet Explorer (IE) doesn’t show JPEG images with CMYK profile

Fun fact: IE doesn’t show CMYK jpeg images. So if you’re wondering some day why your image doesn’t show in IE, but works fine eveywhere else – checks it’s color profile (IrfanView might do the trick)

No Comments

Featureful ieškok.lt

Šiaip visai patogiai padaryta, bet vieno dalyko nepadarė. Nėra kaip pažiūrėti ar tu žiūrėjai anketa, ar ne. Na ką gi, dėka Firefox ir Greasemonkey – dabar jau yra ;)

Prašom: http://userscripts.org/scripts/show/49966

No Comments

IE javascript tricks: don’t delete stuff you’re working with

If you get a reference to let’s say <select> tag and then set innerHTML of it’s container to something else – IE gets whacky… Don’t do that kids. Hide the stuff if you don’t actualy need it but don’t delete it.

,

1 Comment

Dar vienas techdizaino šedevras

Šį kartą: zynios.lt

fireshot-capture-1-zynios_lt-zinios-kitu-kampu-www_zynios_lt

Sveikinimai!

4 Comments

NoSquint

Pasirodo yra FireFox pluginas žlibiems žmonėms, kuris sprendžia problemas geriau, negu minimalaus fonto dydžio nustatymas. Susipažinkite – NoSquint.

No Comments

Oh holy shmoly mother of all! Is Microsoft going to stop anytime soon!?

Neturiu žalio supratimo kas negerai su MS, kodėl jie nepadarė “the right thing” ir neperėjo ant Webkit (kaip Apple) ir kokio velnio jie toliau kuria tą savo žavingą IE, bet žiūrėkit ir gerėkitės!

IE6

IE6

IE7

IE7

Čia po šiokių tokių Javascript pokštų, kurie kuria naują DOM.

Šventas šūde – kam reikėjo naujos naršyklės, kuri ištaiso senas klaidas, bet pridaro naujų?

Mieli interneto puslapių kūrėjai – ruoškitės liūdnai realybei… ie6hacks.css, ie7hacks.css, ie8hacks.css and so on and so forth.

DOH.

,

No Comments

Ruby on Rails and Merb to merge for Rails 3

Ruby on Rails and Merb to merge for Rails 3.

More on Rails + Merb site.

I personally see this as very welcome move in open-source world. As one of ArtsTechnica commenters said: “Whoa, a reverse fork!” :)

,

No Comments

Throttling JS method calls – don’t make useless AJAX requests

This technique is used to avoid having a lot of requests when callbacks run.

Let’s say you have some callback that you invoke after user action. For example to fetch new photo in photo gallery browser.

Gallery = Class.create({
  next: function() {
    // Do some stuff such as store photo id.
    this.callback();
  }

  callback: function() {
    // magic AJAX request code here that fetches info and puts it on screen.
  }
});

So user clicks on next button, callback gets invoked, everybody is fine.

But what if user clicks on next button several times rapidly? Or you introduce changing photos by mousewheel? You get a lot off callbacks (lets say 5) when really you need the last one. And nobody likes useless server load.

What shall we do? I’ll show you the code:

Gallery = Class.create({
  next: function() {
    // Do some stuff such as store photo id.
    setTimeout(this.generateCallback(), 100);
  }

  generateCallback: function() {
    var current = this.photoId;
    return function() {
      if (current == this.photoId) this.callback();
    }.bind(this);
  },

  callback: function() {
    // magic AJAX request code here that fetches info and puts it on screen.
  }
});

So how does this work? Each time you select next image, a generateCallback() is invoked. It stores current photo id in current – a local variable only available to that method invocation. It also returns an anonymous function that is bound to Gallery instance (so this in that function means same as this in next()).

So when user rapidly clicks on next 5 times, 5 functions are generated and they’re going to be invoked after 100ms each. But why don’t they run all?

It’s because of if (current == this.photoId). Because current is local it stores the value of photoId when generator function was invoked. And because that function is bound to this this.photoId is the id set by last next() invocation – the value that we need fetching.

I hope it was clear (thou I think it was not :) ). Inspired by A JavaScript Module Pattern.

BTW: some oil into Prototype/jQuery wars – can you do such things with jQuery?

, ,

17 Comments

Dead simple: accordion

Here you go. My own version of accordion script for prototype/scriptaculous.

,

No Comments

Portalas iš lempos

Apie portaliuką

Kas per portalas?

Ogi čia papraščiausia teminė skelbimų lenta! Iškepta iš lempos per porą dienų prisėdant kada yra laiko ;-)

Na ir kam?

Žmonės per dažnai skundžiasi, jog neturi ką veikti. Arba turi ką veikti, bet neranda su kuo. Aš ir pats pagalvojau, jog visai smagu būtų pažaisti kokius stalo žaidimus su žmogučiais iš savo rajono. Taigi vieną vakarą sėdint namie kilo mintis padaryti portalą, kuris juos suvestų.

Skelbimų lenta? Tiek tesugebi?

Tiesiog dabar laiko ‘full-blown’ portalui nebuvo, tad ir sulipdėm šiokią tokią lentą, kuri kaip ir turėtų bent jau duoti startą tam. Komercinių paskatų kaip ir nėra, tad portalas paprastas iki negalėjimo, bet naudotis galima :)

Ir kas dabar?

Na, visai neblogai būtų, jeigu sugalvotum ir įdėtum skelbimą ;) O toliau… kaip bus taip bus.

Tai tiek :D

No Comments