Skip to content

Instantly share code, notes, and snippets.

View Skhmt's full-sized avatar
💭
Working on random things

Skhmt Skhmt

💭
Working on random things
View GitHub Profile
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active April 26, 2024 04:52
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@sgdan
sgdan / gzip.kts
Last active April 4, 2024 06:02
Kotlin code to compress/uncompress a string with gzip
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun gzip(content: String): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(content) }
return bos.toByteArray()