Archive for the 'javascript' Category

23
Jun
09

javascript documentation


Tonight, I had to write some JavaScript code, and I wanted to know what are some of the methods of nodes and other stuff. Because I didn’t want to be firebugging them I searched for online documentation.

I’ve found this : http://krook.org/jsdom/index-all.html. It seems complete as far as I can tell, it helped me accomplish what I needed to do.

12
Mar
09

i’m learning web development

In the past few weeks, I had many job offers. All of them were related to web design/web application development. Because my web skills are pretty much non-existent, I had to turn them down.

So, in an effort to become a better developer, I’m learning webpy as a web framework, and mootools as a javascript framework.

Because I don’t want to be reading books and tutorials related to building “web skills”, I decided to learn them by writing an application. I decided to write a microblogging application. Things are going somewhat well … I have a textarea that “resembles” the ones used in this kind of applications ( somewhat functional ). I still have a long way to go, and I’m pretty excited.

02
Mar
09

first class functions in programming languages


I first learned about first class functions in Javascript, and I really loved the possibility of doing something like this :


function x(a,fun) {
  for(var i = 0;i<a.length;i++) {
    fun(a[i]);
  }
}

x([1,2,3],function(x) {
    alert(x);
});

The possibility of passing whatever variable and using it as a function blew my mind 3 years ago. These days I use Javascript very little, I’m doing most of my coding in Java/Python/Ruby. We all know the deal about Java and first class functions ( sucks ). Ruby has lambdas and procs, which, in order to be executed, you must call the call method… so, there’s an extra step you have to make. The closest to Javascript syntax is Python, where you have a function like this :


def x(a,fun):
  for elem in a:
    fun(a)

def show(elem):
  print elem

# and you call it like this:
x([1,2,3],show)

Can your language do this? :)