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.

Update:

Two real world examples:

Posted in ,  | 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.
Link

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

published on 02.08.2009 11:45.

Top Talks of Rails Underground

According to SpeakerRate. 5 is the maximum rating.

rated > 4.5
rated > 4
rated > 3.5
rated > 3
  • Rails Is a Hammer 3.33
  • Panel Q&A 3.29
  • Working with Legacy Rails Apps – Technical Debt Hell and how to work your way out of it 3.28
  • Git Basics 3.20
  • Behaviour driven monitoring with cucumber-nagios (no ratings)

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

published on 19.06.2009 23:19.

All tweets must die

I just published my first gem on github, all_tweets_must_die. It will become the core of a web app that regularly deletes your old tweets automatically. If you want to use twitter but value your privacy, this thing is for you.

I build the whole thing for fun and exercise. I’ll try to use as much new stuff as possible – Sinatra for the web app, Cucumber for testing it, CouchDB for storing user auth and preferences, and – if I actually get a couple of users on the site – possibly a small Erlang or Scala program for tweet deletion, connected to Ruby with Thrift. Lot’s of cool new technology, a lot of buzz. I know :-)

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

published on 21.07.2008 00:19.

loading data from mysql into couchdb with rest and ActiveRecord

$KCODE = 'u'

require 'rubygems'
require_gem 'activerecord'
require 'rest_client'

class MyModel < ActiveRecord::Base
end

ActiveRecord::Base.establish_connection(
  :adapter => "mysql", 
  :database => "hello_world", 
  :encoding => 'UTF8'
)

MyModel.find(:all).each do |record|
  p RestClient.post('http://localhost:5984/hello_world', record.to_json)
end

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

published on 12.07.2008 22:28.

Too bad Zed left ...

»When the burning husks of your startups warm
the last of your bones, remember I told you so.«

— Zed, in Rails is a Ghetto

Posted in ,  | no comments | no trackbacks

published on 22.06.2008 16:23.

Ruby on Rails developers use Macs? You must be kidding!

taken at the Rails Konferenz 2008 by patrick lenz.

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

published on 11.11.2007 15:04.

"The suits people are surrounding us."

—Matz, on Ruby becoming “Enterprisey” (via project.ioni.st)

that’s almost a shock, makes me afraid. but he’s right—at last railsconf europe for example, sun, ibm & co showed up. pushing their tools, and ideas of “how to develop”, without any deeper knowledge of ruby. let’s hope they’ve learnt or are willing to learn, and aren’t just disguising just to enter this market and sell their stuff to people who can’t tell the difference.

make sure ruby and the community stay the way they are, it’s what’s makes it special, and what made it successful.

Posted in ,  | no comments

published on 07.10.2007 14:02.

so what's duck typing?

duck typing is actually a simple concept. the best explanations i have come across (from wikipedia 1, 2):

»Suppose you see a bird walking around in a farm yard. This bird has no label that says ‘duck’. But the bird certainly looks like a duck. Also, he goes to the pond and you notice that he swims like a duck. Then he opens his beak and quacks like a duck. Well, by this time you have probably reached the conclusion that the bird is a duck, whether he’s wearing a label or not.” (Immerman 1982, p. 102)«

So, in programming, duck typing is a style of dynamic typing in which an object’s current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class, or implementation of a formal interface.

The ruby mailing list has a great post called ”How to duck type? - the psychology of static typing in Ruby”, explaining the rationale and why duck typing is a good thing (in ruby). an excerpt:

»Many people coming to Ruby from a statically-typed language are somewhat afraid of Ruby’s dynamism, or “don’t get it(TM)”. David Black and I (edit: Tim Bates) believe that this is in part because it is thought that the uncertainty and changeability built into Ruby are dangerous and one wants to find shelter from them.«

Posted in ,  | Tags , ,  | no comments

published on 11.08.2007 16:32.

25 german startups, and their technology choices

jetzt.de (the “youth” magazine of the süddeutsche zeitung) gives an interesting overview of 25 current german startups, asking every one of them around a dozen questions.

greenmiles.de

i found the greenmiles.de idea particularly interesting: you enter your planned trip and transportation type, then they calculate how much co2 is produced. you can then donate an appropriate amount of money to climate conservation programs, allowing you trip to be climate neutral. of course very rough, but nevertheless interesting feedback on how much co2 one of us produces in his day to day life. for example, one round-trip flight hamburg-munich produces 9m³ of co2, which equals a cost of 8 euros.

german startup technology choices

i was curious which technologies these startups would consider best for their success, so i looked at the programming languages and frameworks they used. here are the results:

60% php
16% ruby (= ruby on rails)
16% java
4% asp.net
4% (project offline)

a couple of observations:

php & java have been at the availability of web developers since at least 1999 (that’s when i started) and ruby on rails had it’s 1.0 release in december 2005. so i can only say: go rails! :-)

so let’s say konichiwa to these ruby on rails projects:

looking at php

of course with 60%, php is the most important language by far. it’s the technology one needs least development experience for, and it allows fast results; therefore very appealing. working with less experienced developers however also means things can go really bad down the road – remember the studivz scalability and security issues, for example. and still not all of the startups seem to do their php development in a professional way. some use a CMS (typo3) as a base for their site, others still run php version 4, which has been replaced by php5 three years ago and is now discontinued.

there is only rails

the java and php projects use a variety of frameworks, but in the ruby projects – there is only rails. that’s good – a ruby web developer will almost certainly know how to work with rails. a php developer will more than likely not know how to work with your framework, since there are so many open source php frameworks out there, and still many people roll their own one.

on a side note, only one startup runs on microsoft technology …

i figured out what a site runs by looking at their webserver’s responses (server type, cookie name) and the generated html. if in doubt i checked their tech jobs postings, too. for the technically inclined, here’s the full list:

  • dealjaeger.de: java
  • spickmich.de: php
  • cellity.com: java (jboss)
  • autoaid.de: php (symfony) AND/OR python
  • hitflip.de: php
  • verwandt.de: php
  • amiando.de: java
  • dawanda.de: ruby on rails (/w mongrel server)
  • hiogi.de: php
  • zeitkapsel.de: php
  • wazap.de: java
  • schutzgeld.de: php (typo3)
  • frazr.de: php
  • rankaholics.de: php
  • sevenload: php
  • imedo.de: ruby on rails (/w mongrel server)
  • globalzoo.de: php
  • greenmiles.de: php (typo3, still php4!)
  • jajah.com: asp.net
  • mitbringzentrale.de – (offline)
  • mymuesli.de: php (still php4!)
  • qype.de: ruby on rails (/w lighttpd server)
  • spielerkabine.de: ruby on rails (/w lighttpd server)
  • edelight.de: php
  • studivz.de: php

Posted in , ,  | no comments

Older posts: 1 2 3