seen from Greece

seen from United States

seen from China
seen from United States

seen from Romania

seen from United States
seen from Türkiye
seen from China
seen from China

seen from Germany

seen from Türkiye
seen from Germany

seen from United States
seen from Mexico

seen from United States
seen from Germany

seen from United States

seen from United States
seen from China

seen from United Kingdom
Virtual Hosts in HHVM
This is a simple way of creating Virtual Hosts for HHVM. When you’re doing this on your local machine. Don’t forget to edit your hosts file and add a loop back to the domain (ex. 127.0.0.1 collideborate.local)
HackLang: Vector、Map、Set で filter、map を使う
Vector、Map にはキーを引数にとることのできる filterWithKey、mapWithKey も用意されている。reduce は用意されていない。
$v = Vector {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; $ret = $v->filter($value ==> $value % 2 === 0) ->map($value ==> $value * $value); $ret2 = $v->filterWithKey(($key, $value) ==> $key % 2 === 0) ->mapWithKey(($key, $value) ==> $value * $value); var_dump( [4, 16, 36, 64, 100] === $ret->toArray(), [1, 9, 25, 49, 81] === $ret2->toArray() );
$map = Map {'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5 }; $ret3 = $map->filter($value ==> $value % 2 === 0) ->map($value ==> $value * $value); $ret4 = $map->filterWithKey(($key, $value) ==> $key === 'c' || $key === 'e') ->mapWithKey(($key, $value) ==> $value * $value); var_dump( ['b' => 4, 'd' => 16] === $ret3->ToArray(), ['c' => 9, 'e' => 25] === $ret4->ToArray() );
Set の場合、filterWithKey、mapWithKey は用意されていない。
$set = Set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; $ret5 = $set->filter($value ==> $value % 2 === 0) ->map($value ==> $value * $value); var_dump([4, 16, 36, 64, 100] === $ret5->toValuesArray());
Successfully installed Hack on OSX
Successfully installed Hack on OSX
I finally successfully installed hack installed on OSX.
Here are the steps I followed:
I followed the steps on this page using the “Install by Hand” method: https://github.com/facebook/hhvm/wiki/Building-and-installing-HHVM-on-OSX-10.9
Everything was cool, until I got to the step when I needed to enter the make command: make -j4
The make ran successfully until the very end, of course, and then I…
View On WordPress
HackLang: コンストラクターの引数でプロパティを宣言する
Hack ではコンストラクターの引数でプロパティの宣言ができる。マニュアルではこの機能をコンストラクター引数のプロモーション(昇格)と読んでいる。
class Foo { public function __construct(public string $bar = 'baz') {} } $foo = new Foo; var_dump( 'baz' === $foo->bar );
HackLang: ラムダ式の短縮構文を使う
Hack ではラムダ式の短縮構文の ==> が用意されている。
$f = function($x) { return $x + 1; }; $g = $x ==> $x + 1; $h = $x ==> { return $x + 1; }; var_dump( 3 === $f(2), 3 === $g(2), 3 === $h(2) );
複数の引数を指定するにはかっこで囲む。
$f = ($x, $y) ==> $x + $y + 1; var_dump( 4 === $f(1, 2) );
Programming productivity without breaking things
Looks like something I wanted for PHP 10 years ago.