Skip to content

Instantly share code, notes, and snippets.

View Aqua-Ye's full-sized avatar

Frederic Ye Aqua-Ye

  • TV Time
  • Paris, France
View GitHub Profile

Keybase proof

I hereby claim:

  • I am aqua-ye on github.
  • I am yefrederic (https://keybase.io/yefrederic) on keybase.
  • I have a public key ASAGJHXzEy3l3BE-961mqVbq5AfWS0hCyk1UPb-VM0gj8Ao

To claim this, I am signing this object:

database int /counter;
function apply(f) {
/counter = Int.apply(#counter, f);
}
function page(){
<h1 id=#counter>0</h1>
<h1><span onclick={apply(++)}>+</span> <span onclick={apply(--)}>-</span></h1>
}
@Aqua-Ye
Aqua-Ye / HttpRequest.get_form_data
Created April 2, 2012 10:53
HttpRequest.get_form_data for Opa
function get_form_data() {
function decode(s) { String.replace("+", " ", Uri.decode_string(s)) }
match (HttpRequest.get_body()) {
case {none}: StringMap.empty
case {some:body}:
match (Parser.try_parse(UriParser.query_parser, body)) {
case {none}: StringMap.empty
case {some:list}:
List.fold(function((a, b), acc) {
StringMap.add(decode(a), decode(b), acc)
@Aqua-Ye
Aqua-Ye / bs.opa
Created March 10, 2012 12:39
Opa Bootstrap v1.4.0 with JS syntax : Button
import stdlib.themes.bootstrap.v1.4.0
import stdlib.widgets.bootstrap
function start() {
my_button = WBootstrap.Button.make(
{button:<>Hello</>, callback:ignore}, [{primary}]
)
<h1>Hello</h1> <+>
my_button
}