Skip to content

Instantly share code, notes, and snippets.

View trianglman's full-sized avatar

John Judy trianglman

View GitHub Profile

Keybase proof

I hereby claim:

  • I am trianglman on github.
  • I am trianglman (https://keybase.io/trianglman) on keybase.
  • I have a public key ASDGU0u0ePa0bjBAViw_whFth0fzBCMdORRFJhWNj2aX7Ao

To claim this, I am signing this object:

@trianglman
trianglman / Datastore.php
Last active January 3, 2022 16:13
Userland typed JSON deserializer
class DataContainer {
public function __construct(public string $param1, public int $param2)
{
}
public static function fromJson(string $json): self
{
return call_user_func_array(fn (string $param1, int $param2) => new self($param1, $param2), json_decode($json, true));
}
}
@trianglman
trianglman / snippet.c
Created August 25, 2014 14:27
extension snippet
typedef unsigned char ed25519_public_key[32];
typedef unsigned char ed25519_secret_key[32];
ZEND_FUNCTION(ec_generate_pk)
{
ed25519_secret_key sk;
int skLen;
int curveType = 1;//EC_ED25519
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &sk, &skLen, &curveType) == FAILURE) {