Skip to content

Instantly share code, notes, and snippets.

View chris-hatton's full-sized avatar
👦
Intrepid

Chris Hatton chris-hatton

👦
Intrepid
View GitHub Profile
@chris-hatton
chris-hatton / DataSizeFormatter.kt
Last active December 31, 2023 11:37
Human Readable Data Size Formatter for Kotlin Multiplatform (uses Common API only)
package datasizeformatter
import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.roundToLong
/**
* Format a human-readable representation of data size, in binary base form.
* e.g. 1024 -> 1 KiB
* @param byteCount The number of bytes to represent in human-readable form. `Long.MIN_VALUE` is unsupported.
@sdeleuze
sdeleuze / kotlin-frontend.md
Last active October 25, 2022 14:50
My call for Kotlin as a major frontend language

My call for Kotlin as a major frontend language

I try to push for quite a long time for first class support for WebAssembly in Kotlin because I really believe that frontend development is a domain where Kotlin can be as strong as in mobile, and because this is something that would also help to increase even more the adoption on server-side.

I truly appreciate all the work already done by Kotlin/JS and Kotlin/Native teams. The dead code elimination tool and the initial WebAssembly support in Kotlin/Native are important steps in the right direction. But I believe that Kotlin needs now to make frontend a real priority to take it to the next level.

Need for a consistent and unified web frontend strategy

The first point I would like to raise is that what Kotlin needs IMO is a consistent strategy about web frontend wich includes both Javascript and WebAssembly related efforts. I can u

@chris-hatton
chris-hatton / AuthModel.swift
Created September 9, 2016 02:55
Associated types and Generic constraints not playing nice in Swift 3.0
import UIKit
protocol HTTPRequest
{
associatedtype ResultType
func start( callback: (ResultType)->() )
}
@chris-hatton
chris-hatton / SelfGenericTypeTest.swift
Last active November 9, 2015 19:27
A test to see whether Swift's Generics system can carry through a self-derived type, which is possible, and often useful, in Java.
class A<SelfType : A<SelfType>>
{
}
class B : A<B> // Line fails to compile with: "'A' requires that 'B' inherit from 'A<B>'" even though it does
{
}