Skip to content

Instantly share code, notes, and snippets.

<?hh
function myLog(string $message): string {
return $message;
}
<?php
declare(strict_types=1);
function add(float $a, float $b): float {
return $a + $b;
}
echo add(1, 2);
<?hh
declare(strict_types=1);
function myLog(?string $message=null): string {
if ($message === null) {
return '';
} else {
return $message;
}
}
<?hh
declare(strict_types=1);
function myLog(string $message=null): string {
if ($message === null) {
return '';
} else {
return $message;
}
}
<?php
declare(strict_types=1);
function myLog(string $message): string {
return $message;
}
function add(int $a, int $b): int {
myLog($a + $b);
return $a + $b;
<?php
function add(int $a, int $b): int {
myLog($a + $b);
return $a + $b;
}
@jazzdan
jazzdan / hhvm.ini
Created March 26, 2015 18:12
HHVM Debugger Settings
hhvm.debugger.enable_debugger = true
hhvm.debugger.enable_debugger_server = true
hhvm.debugger.port = 8089
hhvm.debugger.default_sandbox_path = /var/www/
hhvm.debugger.startup_document = /var/www/index.php
hhvm.sandbox.sandbox_mode = true
@jazzdan
jazzdan / commit.diff
Last active August 29, 2015 14:07
Add option to HHVM similar to --with-config-file-scan-dir
commit 0c41732a7ca14b15437f115c51b06e829988f048
Author: Dan Miller <[email protected]>
Date: Fri Oct 3 16:27:06 2014 +0000
Add config-scan-dir option
diff --git a/hphp/runtime/base/program-functions.cpp b/hphp/runtime/base/program-functions.cpp
index b97e086..ba803f6 100644
--- a/hphp/runtime/base/program-functions.cpp
+++ b/hphp/runtime/base/program-functions.cpp
@jazzdan
jazzdan / test.rb
Created June 18, 2014 22:39
mustache.rb throws an exception
require 'mustache'
output = Mustache.render("<h1>{{{blah}}</h1>", :blah=> "hello world!")
puts output
# =>
#/Users/dmiller/.rbenv/versions/1.9.2-p180/lib/ruby/gems/1.9.1/gems/mustache-0.99.5/lib/mustache/parser.rb:264:in `error': Unclosed tag (Mustache::Parser::SyntaxError)
# Line 1
# <h1>{{{blah}}</h1>
# ^
@jazzdan
jazzdan / test.php
Created June 18, 2014 22:24
Tokens vanishing in mustache.php
<?php
require 'src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
$m = new Mustache_Engine([
'partials' => [
],
]);