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 | |
async function stream_check(resource $stream, string $mode, int $usec): Awaitable<void> | |
{ | |
$r = $w = $e = null; | |
do { | |
if ($mode == "r") { | |
$r = Vector{$stream}; | |
} |
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 | |
$mongo = new MongoClient(); | |
$db = $mongo->test; | |
$collection = $db->selectCollection('session'); | |
$sessionCount = $argv[1]; | |
$sampleCount = $argv[2]; | |
$samples = []; | |
// Setup collection |
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
#!/bin/bash | |
DB="test" | |
COL="tz" | |
ZONES="London Berlin Istanbul" | |
DATE="2000-01-01" | |
echo "System timezone: $(date -R)" | |
echo "" |
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
#!/bin/bash | |
DB="test" | |
COL="tz" | |
ZONES="London Berlin Istanbul" | |
DATE="2000-01-01" | |
echo "System timezone: $(date -R)" | |
echo "" |
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 | |
// this is our generator, dns\* and socket\* are assumed | |
// to be async functions returning promises | |
function read_data_from($hostname, $port) { | |
$ip = yield dns\resolve($hostname); | |
$socket = yield socket\connect($ip, $port); | |
echo yield socket\read(1024); | |
}; |
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 | |
/** | |
* This class provides an enum-like type (as in Java) for PHP | |
* | |
* To create an enum, the enum has to extends this Enum class and defined | |
* a static protected array $enum with its entites. | |
* This array can be either a normal collection, e.g. | |
* | |
* <code> |
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 Gender extends Enum | |
{ | |
protected static $enum = array( | |
'MALE' => array('male', 'm', 'Dear Mr.'), | |
'FEMALE' => array('female', 'f', 'Dear Ms.') | |
); | |
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 NumberToWordConverter | |
{ | |
private $numbers = array( | |
'', 'ein', 'zwei', 'drei', 'vier', 'fünf', 'sech', | |
'sieb', 'acht', 'neun', 'zehn', 'elf', 'zwölf' | |
); | |
private $numbersSingle = array( |
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
String.prototype.lpad = function(length, padString) { | |
var str = this; | |
if (padString == undefined) { | |
padString = ' '; | |
} | |
while (str.length < length) { | |
str = padString + str; | |
} | |
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
<html> | |
<head> | |
<title>VM</title> | |
<style type="text/css"> | |
body { | |
font-family: "Courier New"; | |
font-size: .8em; | |
} | |
OlderNewer