Tag-Archive for » javascript «

Thursday, December 24th, 2009 | Author: Fusselwurm

Dadumdidum… ECMAScript5 (“JavaScript”) gefällt mir. Und weil’s so schön ist, implementier ich schon mal die neuen Arraymethoden… bspw.:

if (typeof Array.prototype.indexOf === 'undefined') {

	/**
	* 15.4.4.14
	* NOTE the second parameter fromIndex is not explicitly stated so that the
	*      method's length property becomes 1
	*
	* @param searchElement array element to be searched for
	* @param fromIndex (optional, integer)
	*/
	Array.prototype.indexOf = function (f) {
		var l = this.length,
			i = arguments[1] || 0;

		i += (i < 0) ? l : 0;

		for (i = Math.max(i, 0); i < l; i += 1) {
			if (this[i] === f) {
				return i;
			}
		}
		return -1;
	};
}

…außerdem gefällt mir dieses Syntax-Highlighting hier :D
to be extended…

Saturday, October 31st, 2009 | Author: Fusselwurm

When trying to add a javascript plasmoid to the KDE Destop (kubuntu 9.10 aka karmic), it showed only this message:

Could not create a javascript ScriptEngine

Very helpful indeed.
Turns out I had to install the package plasma-scriptengine-javascript .

Category: blah  | Tags: , , , ,  | Leave a Comment
Saturday, October 24th, 2009 | Author: Fusselwurm

When having a romantic streak, normal heart shapes are not enough for me. They have to be special. That’s why I wrote an ASCII art generator.
Be warned: It works in Firefox 3.5, and I suspect nowhere else. I do not care enough, but if you want to improve upon things, I put the code on github.
Also, it’s really slow, but that’s the prize to pay for doing graphics in Javascript. ;)

       ''
          ,wNWWWH|
       'WWWWWWWWWWWWWc        ~"tc!':-^>oRt,
      WWWW#        /WWW0    ,Yt)         ^1WW`
     WWW1\            WWWV !)^-M`": ^"  \   !Wo~
    WWW   :      Wj   WWWWWW}':    tW        MW,
    WWC  J      ^WWWWWW= :WWW0~ ,<@WWNRWBWt``WAc
   'WW  MT,-     'zHo^  ^   /JWWWs>/      'NWr >
   3WWD     ,:"~- :          )WW  ,         W-
    aWWzWf !A[             |  3  `^        !  W
     zWWWWD#}  yW   W        NM          WW  Wr
      @WWWWWWWWr         -WWWWWW'        WRkW^
         xWWWW9c'> ,,   8W0~'JMWWWx     WWWo
           >@W2tHBWWX  :WN      WW,   WWW^
             ~0 +   cW   vW     EW'hWWw
               -wk4x^Wx        vWWWt
              v   `+6A[!:'   %WWD
                       "^' 4WWW
                        :^ WW{W
                         vW}
                          W         

(I took the liberty of using an image by Aleksejs Kostins here).

Category: blah  | Tags: , , , ,  | 3 Comments