Skip to content

Instantly share code, notes, and snippets.

View canni's full-sized avatar

Dariusz Górecki canni

  • London, United Kingdom
View GitHub Profile

Keybase proof

I hereby claim:

  • I am canni on github.
  • I am canni ( on keybase.
  • I have a public key ASB1gRf_XuAQQdaVhpJrpnsqhU1_nfpNE-iQg0_VF955Dgo

To claim this, I am signing this object:

canni / BenchmarkIt.kt
Last active October 5, 2017 11:42
Go like benchmark function for Kotlin
import kotlin.system.measureTimeMillis
fun benchmarkIt(msg: String, block: (Int) -> Unit) {
var n = 1
var duration: Long
do {
duration = measureTimeMillis { repeat(n, block) }
n *= 2
} while (duration < 100L)
canni /
Last active November 5, 2015 02:11
SQLAlchemy Enum column type using python's enum34
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from enum import Enum
from sqlalchemy.types import SchemaType, TypeDecorator
from sqlalchemy.types import Enum as SAEnum
class EnumType(SchemaType, TypeDecorator):
def __init__(self, enum, name):