$ brew install autoconf automake gmp homebrew/versions/bison27 gd freetype t1lib gettext zlib mcrypt
$ git clone --depth=1 https://github.com/php/php-src.git
$ cd php-src
class HttpUrl | |
ALPHA = "[a-zA-Z]" | |
DIGIT = "[0-9]" | |
DIGITS = "#{DIGIT}+" | |
SAFE = "[-$_.+]" | |
EXTRA = "[!*'(),]" | |
ALPHADIGIT = "[a-zA-Z0-9]" | |
TOPLABEL = "#{ALPHA}(#{ALPHADIGIT}|-)*#{ALPHADIGIT}|#{ALPHA}" |
/*global $,localStorage*/ | |
$.fn.draft = function () { | |
'use strict'; | |
if (!localStorage) { | |
return; | |
} | |
var form = $(this), | |
fields = form.find('input,select,textarea'), |
DROP FUNCTION IF EXISTS lowerword; | |
DELIMITER | | |
CREATE FUNCTION lowerword( str VARCHAR(128), word VARCHAR(5) ) | |
RETURNS VARCHAR(128) | |
DETERMINISTIC | |
BEGIN | |
DECLARE i INT DEFAULT 1; | |
DECLARE loc INT; | |
SET loc = LOCATE(CONCAT(word,' '), str, 2); |
public class Solution { | |
public void traverse(TreeNode root) { | |
Queue<TreeNode> nodes = new ArrayList(); | |
nodes.add(root); | |
while (!nodes.isEmpty()) { | |
TreeNode node = nodes.remove(); | |
System.out.println(node.val); | |
if (node.left != null) queue.add(node.left); |
const cons = (x, y) => (m) => m(x, y); | |
const car = (z) => z((p, q) => p); | |
const cdr = (z) => z((p, q) => q); | |
const pair = cons(1, 2); | |
console.log(car(pair), cdr(pair));//1 2 | |
const list = cons(1, cons(2, cons(3, cons(4, null)))); | |
const each = (l, fn) => cdr(l) ? (() => {fn(car(l)); each(cdr(l), fn)})() : fn(car(l)); | |
each(list, console.log);//1 2 3 4 |
(define (create-user name) | |
(define say-hello | |
(print "Hello " name)) | |
(define (change-name new-name) | |
(set! name new-name) | |
name) | |
(define (dispatch method) | |
(cond | |
((eq? method 'say-hello) say-hello) | |
((eq? method 'change-name) change-name) |
(defn make-acumulator [value] | |
(def acc (atom value)) | |
(fn [add] | |
(swap! acc #(+ % add)) | |
@acc)) | |
(def a (make-acumulator 10)) | |
(a 10) | |
;20 |
; Let lambda syntactic sugar | |
(let [var1 exp1 | |
var2 exp2] | |
(do-something var1 var2)) | |
((fn [var1 var2] | |
(do-something var1 var2)) | |
(exp1 exp2)) |
; LINEAR RECURSION | |
(define (factorial n) | |
(if (= n 1) | |
1 | |
(* n (factorial (- n 1))))) | |
(factorial 3) | |
;(* 3 (factorial 2)) | |
;(* 3 (* 2 (factorial 1))) | |
;(* 3 (* 2 1)) |