This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function xs() { | |
$i = 0; | |
while (true) { | |
yield $i++; | |
} | |
} | |
$xs = xs(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
mb_internal_encoding("UTF-8"); | |
function λ($fn) { | |
list($args, $body) = explode('=>', $fn, 2); | |
$args = trim($args); | |
$args = ltrim($args, '('); | |
$args = rtrim($args, ')'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?hh | |
function addOne(int $x): int { | |
return $x + 1; | |
} | |
function main() { | |
addOne(42); | |
addOne('foo'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get -y install wget | |
RUN wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | apt-key add - | |
RUN echo deb http://dl.hhvm.com/ubuntu trusty main | tee /etc/apt/sources.list.d/hhvm.list | |
RUN apt-get update | |
RUN apt-get -y install hhvm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
mb_internal_encoding("UTF-8"); | |
$ = 'foo'; | |
$x = 'bar'; | |
echo $ . $x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# watch files and rerun phpunit on changes | |
phpunitwait() { | |
while inotifywait $(find $1 -name '*.php'); | |
do | |
clear; | |
phpunit --colors $2; | |
done; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grep messages from weechat logs | |
channelgrep() { | |
channel=$1 | |
search=$2 | |
channelFiles=~/.weechat/logs/*#$channel* | |
grep "$search" $channelFiles | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/vendor/autoload.php'; | |
$file = __DIR__ . '/testfile'; | |
$client= popen('tail -f ' . $file, 'w'); | |
stream_set_blocking($client, 0); | |
$loop = React\EventLoop\Factory::create(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysum :: Num a => [a] -> a | |
mysum [] = 0 | |
mysum (x:xs) = x + mysum xs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class App | |
{ | |
public $callables = []; | |
public function __construct() | |
{ | |
register_shutdown_function([$this, 'run']); | |
} |
OlderNewer