Aller au contenu | Aller au menu | Aller à la recherche

vendredi 30 juillet 2010

Brookline's new kosher butcher shop has a name

How grep got its name

Seattle startup names: verbal bootstrapping

 
 

Hydrogen Templates

def H _
  case _
  when Hash then
    '<'+(_[:_]||:div).to_s+(_.keys-[:_,:c]).map{|a|
      ' '+a.to_s+'='+"'"+
      _[a].to_s.hsub({"'"=>'%27',
                       '>'=>'%3E',
                       '<'=>'%3C'})+"'"}.join+'>'+
      (_[:c] ? (H _[:c]) : '')+
      '</'+(_[:_]||:div).to_s+'>'
  when Array then
    _.map{|n|H n}.join\
  else
    _.to_s
  end
end

this is sort of an anti-template-language. some allow you to write pretty code - but after a few rounds of learning all the syntactic subtleties of another language, scrounge around for tricks to do some subset of control structures, trying to get your editor add-on properly highlighting the embedded code-within-code, inventing caching schemes to avoid running an almost-turing-complete language-implemented-in-slow-scripting-language-of-choice, familiarizing yourself with said mountain of code so you can create a patch when something breaks, i wrote this

the example here is rewriting BBC News' content to avoid scanning all over the page with a nonsensical hodpodge of random squares & whitespace, missing article descriptions, massive-icon sidebars and so on. i used element to do on-the-fly feedparsing and model generation..

Hash literals are elements, if you don't provide a tagname, it defaults to divs, attributes work as expected Arrays can contain Arrays, Hashes, or strings.. Strings allow you to drop down to retro HTML if youre in the mood, i did here:

not quite as pretty as Haml, but definitely blazing fast and trivial to port to new languages (with at least Record/Hash/Table and Array constructors) in a few minutes

jeudi 29 juillet 2010

lundi 26 juillet 2010

thin


# curl http://github.com/macournoyer/thin/raw/master/CHANGELOG | grep == | sed -e s/\ release.*//
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14204  100 14204    0     0  84243      0 --:--:-- --:--:-- --:--:--  122k
== 1.2.8 Does It Offend You, Yeah?
== 1.2.7 No Hup
== 1.2.6 Crazy Delicious
== 1.2.5 This Is Not A Web Server
== 1.2.4 Flaming Astroboy
== 1.2.2 I Find Your Lack of Sauce Disturbing
== 1.2.1 Asynctilicious Ultra Supreme
== 1.2.0 Asynctilicious Supreme
== 1.1.1 Super Disco Power Plus
== 1.1.0 Super Disco Power
== 1.0.0 That's What She Said
== 0.8.2 Double Margarita
== 0.8.1 Rebel Porpoise
== 0.8.0 Dodgy Dentist
== 0.7.1 Fancy Pants
== 0.7.0 Spherical Cow
== 0.6.4 Sexy Lobster
== 0.6.3 Ninja Cookie
== 0.6.2 Rambo
== 0.6.1 Cheesecake
== 0.6.0 Big Pony
== 0.5.4 Flying Mustard
== 0.5.3 Purple Yogurt
== 0.5.2 Cheezburger
== 0.5.1 LOLCAT
== 0.5.0
== 0.4.1
== 0.4.0

examine

samedi 24 juillet 2010

vendredi 23 juillet 2010

27 Really Terrible Boston Restaurant Names

mercredi 14 juillet 2010

- page 2 de 30 -