Skip to content

Instantly share code, notes, and snippets.

View mklabs's full-sized avatar

Mickael Daniel mklabs

View GitHub Profile
<?php
header('content-type: application/json; charset=utf-8');
/* * /
$phi = array('okey' => 0, 'object' => array ("firstName"=> 'Philippe', 'lastName'=> 'Charriere'));
$j = array('okey' => 1, 'object' => array ('firstName'=> 'John', 'lastName'=> 'Resig'));
$v = array('okey' => 2, 'object' => array ('firstName'=> 'Linus', 'lastName'=> 'Torvald'));
$m = array('okey' => 3, 'object' => array ('firstName'=> 'Douglas', 'lastName'=> 'Crockford'));
/* */
function list_return(return_values){
this.Objects = return_values;
function add_li(list, text) {
var list = document.getElementById(list);
var li = document.createElement("li");
li.innerHTML = text;
list.appendChild(li);
}
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}