Skip to content

Instantly share code, notes, and snippets.

View azjezz's full-sized avatar
😶

Saif Eddin Gmati azjezz

😶
View GitHub Profile
@azjezz
azjezz / connect.js
Last active October 31, 2019 19:47
function user(uuid) {
let headers = new Headers({
'Accept': 'application/json'
})
let request = new Request('https://connect.symfony.com/api/users/' + uuid, {
method: 'GET',
headers: headers,
mode: 'cors',
cache: 'default'
<<__ReturnDisposable>>
function closeOnScopeExit<<<__Enforceable>> reify T as Mode>(
Handle<T> $handle,
): DisposableHandle<T> {
return new DisposableHandle<T>($handle);
}
@azjezz
azjezz / MemoryHandle.hack
Last active October 15, 2019 21:27
MemoryHandle implementation. ( see hhvm/hsl-experimental#58 )
namespace Nuxed\IO;
/*
* This file is part of the Nuxed package.
*
* (c) Saif Eddin Gmati <azjezz@protonmail.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@azjezz
azjezz / Extension.hack
Last active June 6, 2019 21:22
Nuxed Hello world
use namespace Nuxed\Kernel;
use namespace Nuxed\Container;
use namespace Nuxed\Http\Router;
use namespace Nuxed\Http\Router\Generator;
final class Extension extends Kernel\Extension\AbstractExtension {
// register container services
public function register(
Container\ContainerBuilder $builder,
): void {
@azjezz
azjezz / colors.css
Created May 8, 2019 23:41
Colors used at Polar
/** Colors **/
.primary {
color: #BDC6FF;
}
.secondary {
color: #F4C2C2;
}
.success {
color: #00cec9;
```
use namespace HH\Lib\Vec;
function process(
vec<(string, string, string, string)> $input
): dict<string, dict<string, dict<string, vec<string>>> {
$result = dict[];
foreach($input as $tuple) {
$result[$tuple[0]][$tuple[1]][$tuple[2]] = Vec\concat(
$result[$tuple[0]][$tuple[1]][$tuple[2]] ?? vec[],
$baz as Baz -> passed.
$qux as Baz -> failed : Expected Baz, got Qux.
$baz as Qux -> failed : Expected Qux, got Baz.
$qux as Qux -> passed.
$baz as Foo -> passed.
$qux as Foo -> passed.
$baz as Bar -> failed : Expected Bar, got Baz.
$qux as Bar -> passed.
$baz as string -> failed : Expected string, got Baz.
$baz as int -> failed : Expected int, got Baz.
require __DIR__.'/vendor/autoload.hack';
use namespace HH\Asio;
use namespace HH\Lib\Str;
use namespace Facebook\TypeAssert;
final class GithubPublicInformation {
const type TFileInfo = shape(
'sha' => string,
'filename' => string,
@azjezz
azjezz / polyfill.hh
Last active February 11, 2019 23:28
Polyfill for `call_user_func` and `call_user_func_array` in hack lang
<?hh // strict
namespace Polyfill;
use type ReflectionMethod;
use type ReflectionFunction;
function call_user_func(mixed $callable, mixed ...$args): mixed {
return call_user_func_array($callable, $args);
}
@azjezz
azjezz / hell.hh
Created February 2, 2019 15:35
Code that i wish didn't work
<?hh // strict
use namespace HH\Asio;
/**
* Hate both the player, and the game.
*/
<<__EntryPoint>>
async function main(): Awaitable<void> {