Notes posted by tordans

RSS feed
December 20, 2010
0 thanks

New Website for RedCloth

The Link above doesnt work anymore. This one should be the new one: http://redcloth.org/

September 27, 2010
0 thanks

Nice german translation independet of structure of a sentence

Eine pragmatische Lösung für das Übersetzungsproblem der Rails Methode distance_of_time_in_words(). Im Deutschen wird je nach Satzbau eine andere Ausgabe benötigt.

Vor mehr als 5 Monaten“/”Vor etwa einem Jahr“ — statt wie im Original ”Dauer: mehr als 5 Monate“/”Dauer: etwa 1 Jahr


November 26, 2009
0 thanks

How to check if a Yield has content?

How do I do this without actually calling the yield?

- if yield :footer
  = yield :footer
- else
  = render "layouts/footer_big"

(Note: HAML Syntax) Thanks.

November 26, 2009
0 thanks

How to use with HAML

Are you using HAML and try to do the block-thing (do…)? Please note that the whole block has to be in a single line. More: http://groups.google.com/group/haml/browse_thread/thread/52e62ef501c504a3

October 3, 2009
0 thanks

Shortcut with %

Thanks iamcata, that works :). And I finally found the right place to put this comment: http://apidock.com/ruby/String/%25#726-Use-it-with-HAML

October 3, 2009
1 thank

Use it with HAML

Like Henrik pointed out <a href=“http://henrik.nyh.se/2008/01/surround-helper-alternative-in-haml”>in his blogpost, this method is particulary useful when using HAML (http://haml-lang.com/) in Rails.

Instead of usind the HAML-Helper ‘surround’ (etc) you can just write

= "(%s)" % link_to("Edit", ...)

Or with two Arguments:

= "(%s, %s)" % ["Edit", "Delete"]

Thanks very much, Henrik!

September 28, 2009
1 thank


According to http://henrik.nyh.se/2008/01/surround-helper-alternative-in-haml there is a short version for sprintf:

“(%s)” % “foo” is the same as sprintf(“(%s)”, “foo”)

Can someone who knows write more about this here? How do I work with multiple strings? Is this even possible? “(%s %t)” % “foo”, “bar” does not work.