Skip to content

Instantly share code, notes, and snippets.

View Scriptor's full-sized avatar

Tamreen Khan Scriptor

  • New York City
View GitHub Profile
<connectors>
<http-connector name="http-connector" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor"/>
</http-connector>
<http-connector name="http-connector-throughput" socket-binding="http">
<param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>
<param key="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
def foo(stuff):
return stuff
def bar(stuff):
return 3 * stuff
def f(func, stuff):
return 2 * func(stuff)
f(bar, 5) # =>
function sum(x){
return function(y){
return x + y;
};
}
sum(2)(3);
// or alternatively
<html>
<head>
<title><?php echo $title;?></title>
</head>
<body>
<?php include $sub_template; ?>
</body>
</html>
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort [a | a <- xs, a <= x]
biggerSorted = quicksort [a | a <- xs, a > x]
in smallerSorted ++ [x] ++ biggerSorted
@Scriptor
Scriptor / main.php
Last active December 26, 2015 13:59
<?php
foreach($rows as $row) {
$name = $row['name'];
$date = $row['date'];
include('tr_partial.php')
}
<?php
class A {
public $foo = 1;
public $bar = 2;
public $veryverylongattrnamethatisridiculouslylongthankyouautocomplete = 3;
}
$a = new A;
$b = new SplFixedArray(3);
(fn stepper (state _)
(let [pc (:state :pc)
instrs (:state :instructions)
instr (:instrs pc)]
(cond
((=== (:instr 0) :jmp) {:pc (:instr 1), :instructions instrs}))))
(reduce #stepper [[:jmp 1] [:jmp 0]] (infinity))
(ns stream-play)
(use pharen.io.async as io)
(let
[addr (gethostbyname "www.example.com")
client (stream_socket_client (. "tcp://" addr ":80")
errno error-msg 30
(| STREAM_CLIENT_CONNECT STREAM_CLIENT_ASYNC_CONNECT))
read (arr [client])
write (arr [client])
<?php
declare(ticks=10);
// A function called on each tick event
class Counter {
static $a = 0;
static $b = 0;
}