Skip to content

Instantly share code, notes, and snippets.

Avatar

Dariusz Górecki canni

  • London, United Kingdom
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am canni on github.
  • I am canni (https://keybase.io/canni) on keybase.
  • I have a public key ASB1gRf_XuAQQdaVhpJrpnsqhU1_nfpNE-iQg0_VF955Dgo

To claim this, I am signing this object:

@canni
canni / BenchmarkIt.kt
Last active Oct 5, 2017
Go like benchmark function for Kotlin
View BenchmarkIt.kt
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
canni / enum.py
Last active Nov 5, 2015
SQLAlchemy Enum column type using python's enum34
View enum.py
# -*- 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):
You can’t perform that action at this time.