Skip to content

Instantly share code, notes, and snippets.

View trunghq3101's full-sized avatar

Miller Go Dev trunghq3101

View GitHub Profile
@trunghq3101
trunghq3101 / zlibDecompress.kt
Created May 30, 2020 14:41 — forked from eren/zlibDecompress.kt
Zlib Inflate/Decompress in Kotlin
/**
* Zlib decompress a file and return its contents
*
* @param filePath absolute path to file
* @return unzipped file contents
*/
fun decompress(filePath: String) : String {
val content = File(filePath).readBytes()
val inflater = Inflater()
val outputStream = ByteArrayOutputStream()
@trunghq3101
trunghq3101 / list_item.dart
Last active March 28, 2022 01:14
Make item content wrapped vertically inside a horizontal ListView
// ListView applies a tight constraint (minHeight = maxHeight in this case) to its children.
// So all children are forced to have the same height. To let an item to have its own size,
// first, remove constraints by using UnconstrainedBox.
// then, apply new loosen constraints with ConstrainedBox.
// Using only UnconstrainedBox would be sufficient in this specific case,
// but it can cause errors in case the child want to be as big as possible.
// So ConstrainedBox is needed to provide a specific constraints.
ListView(
scrollDirection: Axis.horizontal,
meta:
title: The Lost Adventure
description: A magical bedtime story about a curious boy who learns the value of courage and wisdom.
author: Lily
version: 1.1.0
items:
- id: flashlight
name: Shimmering Lantern
description: A tiny lantern that glows with a soft golden light. Helpful in the dark.