published on 03.02.2013 15:27.

Why I really like the Slim template language

I recently discovered the Slim template language. My first thought was: why bother, HAML is already much better than plain HTML/ERB, so there’s really no point in learning yet another template language.

But I still find some things in HAML awkward or hard to remember, so I gave Slim a try on a recent project. Here’s what I found:

  • even less syntax noise, for example: no leading % for HTML tags, cleaner multiline
  • consistent, shorter attribute syntax (see the example here)
  • regular HTML is allowed in templates. Among other things, this helps converting ERB templates by hand.
  • slim/translator: no need to wrap I18n keys in = t(’.your_key’)
  • (claims to be) very fast.
  • after having used it for ~10 templates, there were no weird errors or stuff I couldn’t do.

The only downside I found is that there doesn’t seem to be a reliable HTML/HAML to Slim converter, yet.

You don’t have to actually learn Slim. The syntax is extremely similar to HAML: leave out %, (), {} and ”” in most places, and you get Slim. Where not, things can be looked up in the documentation just as quickly as for HAML.

Replacing HTML/ERB with HAML still is the biggest win, but Slim is the better HAML to me. I’ll be playing with it on a side project (shameless plug) and may use it from the start for the next big one.


Two real world examples:

Posted in ,  | no comments | no trackbacks

published on 15.08.2012 12:00.

Software idea: find what you read

Find What you Read

Intended to be hosted on your own private server on the internet (or internally, like a Protonet node), to make it accessible from everywhere.

Browser plugin
  • sends every viewed page to the server (data: url, and date viewed)
  • available for Firefox and Chrome
Server component
  • Indexes each document in a fulltext search engine
  • has a web interface which:
    1. list all indexed documents
    2. has a fulltext search
    3. has relevant facets (date read, domain, ... some would need to be generated)
    4. can group documents by semantic analysis
    5. can derive tags automatically
    6. knows which documents were read together and shows these
    7. document previews and screenshots
    8. normalization of tag variations: synonyms, ontologies, German/English tags

Later: add a browser plugin to do the same as the web interface.

See also:

Posted in  | no comments | no trackbacks

published on 03.08.2012 13:51.

Hello World from Textmate

Hello World from TextMate Blogging! Blogging From Textmate

no comments | no trackbacks

published on 03.08.2012 12:20.

Plenty of sharp knives.

> 22.12.2005
>"open class" is so strong (often too strong), we can break 
> things easily.  In other word, Ruby trust you to give you
> sharp knives, where Python don't.  From the Python point 
> of view, it's wrong, I guess.
>                                                matz.

Posted in ,  | Tags ,  | no comments | no trackbacks

published on 17.02.2012 03:15.

Not a single fuck was given that day

no comments | no trackbacks

published on 13.02.2012 12:58.

The value of readable code

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other is to make it so complicated that there are no obvious deficiencies.”
—Tony Hoare, 1991

Posted in  | no comments | no trackbacks

published on 16.12.2011 19:56.

The origin of vi

<b>vi</b>: /V-I/, *not* /vi/ and *never* /siks/ n. 
[from `Visual Interface'] A screen editor crufted 
together by Bill Joy for an early {BSD} release. 
Became the de facto standard UNIX editor and a nearly
undisputed hacker favorite outside of MIT until the
rise of {EMACS} after about 1984. Tends to frustrate
new users no end, as it will neither take commands
while expecting input text nor vice versa, and the
default setup provides no indication of which mode
the editor is in (one correspondent accordingly 
reports that he has often heard the editor's name 
pronounced /vi:l/). Nevertheless it is still widely
used (about half the respondents in a 1991 Usenet
poll preferred it), and even EMACS fans often
resort to it as a mail editor and for small editing
jobs (mainly because it starts up faster than the
bulkier versions of EMACS). See {holy wars}.

LM:: What inspired you to write vi?
Billy Joy: What happened is that Ken Thompson came to Berkeley and brought this broken Pascal system, and we got this summer job to fix it. While we were fixing it, we got frustrated with the ed­itor we were using which was named ed. ed is certainly frustrating. We got this code from a guy named George Coulouris at University College in London called em - Editor for Mortals - since only immortals could use ed to do anything. By the way, before that summer, we could only type in uppercase. That summer we got lowercase ROMs for our terminals. It was really exciting to finally use lowercase.

LM: What year was that?
BJ: ‘76 or ‘77. It was the summer Carter was president. So we modified em and created en. I don’t know if there was an eo or an ep but finally there was ex. [laughter] I remember en but I don’t know how it got to ex. So I had a terminal at home and a 300 baud modem so the cursor could move around and I just stayed up all night for a few months and wrote vi.

LM: So you didn’t really write vi in one weekend like everybody says?
BJ: No. It took a long time. It was really hard to do because you’ve got to remember that I was try­ing to make it usable over a 300 baud modem. That’s also the reason you have all these funny commands. It just barely worked to use a screen editor over a modem. It was just barely fast enough. A 1200 baud modem was an upgrade. 1200 baud now is pretty slow. 9600 baud is faster than you can read. 1200 baud is way slower. So the editor was optimized so that you could edit and feel productive when it was painting slower than you could think. Now that computers are so much faster than you can think, nobody understands this anymore. The people doing Emacs were sitting in labs at MIT with what were essentially fibre-channel links to the host, in contemporary terms. They were working on a PDP-10, which was a huge machine by comparison, with infinitely fast screens. So they could have funny commands with the screen shimmering and all that, and meanwhile, I’m sitting at home in sort of World War II surplus housing at Berkeley with a -modem and a terminal that can just barely get the cursor off the bottom line. It was a world that is now extinct. People don’t know that vi was written for a world that doesn’t exist anymore—unless you decide to get a satellite phone and use it to connect to the Net at 2400 baud, in which case you’ll realize that the Net is not usable at 2400 baud. It used to be perfectly usable at 1200 baud. But these days you can’t use the Web at 2400 baud because the ads are 24 kilobytes.

Peter Salus in his Open Source Library – Papers gives the following version of events: The original UNIX editor was ed. It was a line editor of reluctant and recalcitrant style. When UNIX (version 4) got to Queen Mary College, London, in 1973, George Coulouris - a Professor of Computing - wasn’t happy with it. So he wrote a screen editor, which he called “em,” or “ed for mortals.” Coulouris went on sabbatical to Berkeley, where he installed em on “his” machine. A graduate stu­dent noticed it one day, and asked about it. Coulouris explained. He then went off to New Jersey to Bell Labs, and when he returned to Berkeley, he found that em had been transmuted into ex, a dis­play editor that is a superset of ed and a number of extensions—primarily the one that enables display editing. At the beginning of 1978, the first Berkeley Software Distribution was available. It consisted of a tape of the Berkeley Pascal System and the ex text editor. The graduate student was Bill Joy, and the distribution cost $50. The next year Berkeley got some ADM-3a terminals, and Joy rewrote em to vi—a truly visual editor. In sum, ed came out of Bell Labs in New Jersey, went to Queen Mary College in London, from there to the University of California at Berkeley, and from there back to New Jersey, where it was incorporated into the next edition of UNIX.

Posted in  | no comments | no trackbacks

published on 06.12.2011 11:34.

Steve Jobs meets God, receives outdated device

Posted in  | no comments | no trackbacks

published on 08.10.2011 16:44.

A Pixar Goodbye to Steve Jobs

Nice one.

Posted in  | no comments | no trackbacks

published on 27.09.2011 13:49.

Carte Blanche - Gare Du Nord

A side project by DJ Mehdi. He passed away recently.

no comments | no trackbacks

Older posts: 1 2 3 ... 8