miércoles, 29 de febrero de 2012

functional javascript

I already wrote one post some time ago about some javascript that enabled more confortable functional style programming.

Now I come with a few more (that mostly bring bundled functional capabilities in a single package)

Here's a library that brings map,filter,reduce,currying, and some inline string->function->evaluate automatisms.

And a more DIY text with quite a few nice tricks.

jueves, 9 de febrero de 2012

Kiss the cuke

I don't care if you're cuking it right or wrong.

But you can use cukes whatever language you use.
So, there's no excuse, if you like BDD, not to use it.

w3m-redirect automatically

You could take this post as a second iteration on this older post.

There are many urls that are fairly navigable on w3m (emacs-w3m that is). The less html-y the site is, the more confortable it is.

So here's a way to redirect gist links to the raw plaintext counterparts. I just wrote it in 5 minutes, and it's quite inestable, but for the moment, it Works On My Machine. I'll try to make it more general and robust in next few days (as always, with advice from davazp)



Btw, it doesn't work if there is more than 1 file in the gist.

lunes, 6 de febrero de 2012

new emacs mode: expand-region



There's a new mode for emacs that has recently came out. It's called expand-region, and it's probably the nearest we can get to text-objects in emacs. In fact, it's quite interesting that it can be extended for specific major modes.

I had much of the same idea 1 month ago, and tried to implement the same functionality, but failed miserably (kind of worked, but really ad-hoc and hackish).

The basic idea of the plugin is selecting incrementally different semantic units with the same shortcuts.

Mangars is the author, and has kindly applied a couple of pull requests I made (hey, it's my first collaboration in any emacs plugin). I basically added support for disabled transient-mark-mode, and extensions for feature-mode.

On the way, I found out that ecukes and espuds. Nice discover.

And here's my fork of expand-region (that hopefully, you won't need to clone, because the central one is magnars')

Musicz from 10 to 7




What music do you listen to while programming, or just working in front of the PC?

For me that's from Guns and Roses, the Doors, soul and acid jazz, to Fat Boy Slim, Propellerheads, Prodigy and psy-trance.


Here are some comments on HN related to what programmers listen to when doing their job.

* http://news.ycombinator.com/item?id=3547694

* http://djbolivia.blogspot.com/2011/04/music-to-code-by-volumes-1-3.html

And you? what do you listen to while programming?


PS: I got 0 comments on that, and knowing that just a few people reads my humble blog, and many of you are people I know, and I know you listen to music while programming, and on the other side, a good deal of programmers like to listen music while working, I'd love to have responses. otherwise, I get very little motivation to keep up with this blog. C'mon lazyweb. Let's see how it goes with G+.

sábado, 28 de enero de 2012

Lisp and the web (probably part 1)

I've tried some lisp frameworks with different intensities and approaches, without settling with anyone of those. Just looking around.

As a first approach, I'm going for the minimalist frameworks. Caveman (on top of Clack), and RESTAS.

My first experience is with caveman, as I want something really simple, and known. Not that I've worked with Sinatra/Rack nor Flask/WSGI, but at least, the architecture is more well known that with other fw like weblocks or RESTAS.

With Toni, we've been hacking a bit our way to do a super simple micro app. And we stumbled upon a few WTFs, or undocumented Caveman spots, or just blockers for us due to our lisp newbieness. Luckily, most of them are solved now :)
  • In GETs, (getf params :id) work, but in post POSTs, the symbols are presented in a different format (getf params :|id|). As davazp pointed, this probably has some problems issues with CL never garbage collecting those interned symbols.
  • clsql:*default-database*. clsql will use *default-database* database handler if you dont's specify any. This makes using clack's middleware for clsql transparent from caveman apps.
  • Getting caveman through quicklisp threw some erros during installation. Installing newer version of sbcl just solved it. (http://comments.gmane.org/gmane.lisp.steel-bank.announce/111)
     * new feature: SB-EXT:VALID-TYPE-SPECIFIER-P returns whether a given type
specifier is valid where "valid" basically means "would be accepted as
second argument of TYPEP".

  • cl-project doesn't create the link in ~/quickload/local-projects on new generated projects . If you create your projects under ~/quickload/local-projects, quicklisp will be able to quickload it, but if you put it somewhere else, you should create a link to your project.


I'm now struggling with form-builder, and widgets (no docs nor examples at all). We'll see how it goes.

before forgetting them

A couple of amazing links for the weekend