Skip to content

Instantly share code, notes, and snippets.

View Conaclos's full-sized avatar

Victorien Elvinger Conaclos

View GitHub Profile
@Conaclos
Conaclos / bare.zig
Last active April 26, 2022 18:29
Examples of recursive type without support for them
type TypeId uint
type BoolType void
type I8Type void
type I16Type void
type I32Type void
type I64Type void
type IntType void
type StrType void
type U8Type void
@Conaclos
Conaclos / sqlite-base64-gid96.md
Last active March 28, 2022 13:20
SQLite generator of base64 uuid encoded on 96bits (12 octects) in pure SQL

The following SQL statement enables to generate a base64 uuid encoded on 96bits (12 octects).

SELECT (substr(chars, (first & 63)+1, 1) ||
        substr(chars, ((first >> 6) & 63)+1, 1) ||
        substr(chars, ((first >> 12) & 63)+1, 1) ||
        substr(chars, ((first >> 18) & 63)+1, 1) ||
        substr(chars, ((first >> 24) & 63)+1, 1) ||
        substr(chars, ((first >> 30) & 63)+1, 1) ||
        substr(chars, ((first >> 36) & 63)+1, 1) ||
@Conaclos
Conaclos / uint4ordset.ts
Last active June 23, 2018 15:15
Uint4 (hexadecimal digit) ordered set (16bits memory usage and O(1) computational complexity)
/*
Copyright (c) 2018 Victorien Elvinger
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
export type uint4 = number
/**
@Conaclos
Conaclos / deep_join.ts
Created September 18, 2016 16:20
Function that joins conflict-free objects. It copies all (enum, non-enum, and symbol) properties.
/*
Copyright (c) 2016 Victorien ELVINGER
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
interface DeepJoinFunction {
<A, B> (a: A, b: B): A & B

Would you like to change your public committer email? You are in the right place!

Warning: The next git command change the entire branch historic. Apply it only on unshared repositories.

git filter-branch -f --env-filter "GIT_AUTHOR_EMAIL='email@email'; GIT_COMMITTER_EMAIL='email@email';" HEAD

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@Conaclos
Conaclos / once.py
Last active December 14, 2015 09:49
def stable (value):
return lambda *args, **kwargs: value
def once_per_object (unstable):
"""Method decorator. Run only once 'unstable' per instance"""
def stabilize (*args, **kwargs):
self = args [0]
result = unstable (*args, **kwargs)
setattr (self, unstable.__name__, stable (result))
return result