Skip to content

Instantly share code, notes, and snippets.

View cedricss's full-sized avatar

Cédric Soulas cedricss

View GitHub Profile

Type Inference

var number = 15;
var word = "Hello";
var strNumber = 15+" 1";

number.
word.
strNumber.
@cedricss
cedricss / shopping_cart.opa
Created November 27, 2012 11:33
Reactive demos
basket = Reactive.List.cloud([], Template.table_item, Template.table_empty)
basket_summary = Reactive.List.clone(basket, Template.list_item, Template.list_empty)
items_initial = [ "item1", "item2" ]
items = items_initial ++ [ "item3", "item4 ]
function fill(_) { List.iteri({ function(i,v) basket.add(make_item(i,v), i) }, items_initial) }
function random() {
cart_pos = Random.int(List.length(items_initial))
Server.start(
Server.http,
[ { register : { doctype : { html5 } } },
{ title : "hello", page : View.page }
]
)
@cedricss
cedricss / README.md
Created October 10, 2011 13:07
Hello world in OPA, with raw text versions.

How to run this example?

@cedricss
cedricss / README.md
Created October 10, 2011 12:57
OPA http server serving an "Hello world"

How to run this example?

  • Clone https://github.com/MLstate/opalang
  • Install bld with make install-bld
  • In the opalang root directory, compile opa_http_server.ml with bld opa_http_server.native
  • Run it with _build/opa_http_server.native

Notes

You can disable:

@cedricss
cedricss / README.md
Created October 10, 2011 12:44
OPA scheduler serving an http "Hello world" page.

How to run this example?

  • Clone https://github.com/MLstate/opalang
  • Install bld with make install-bld
  • In the opalang root directory, compile opa_scheduler.ml with bld opa_scheduler.native
  • Run it with _build/opa_scheduler.native