Skip to content

Instantly share code, notes, and snippets.

View su-mong's full-sized avatar
🤔
flutter / android

Sumong su-mong

🤔
flutter / android
View GitHub Profile
@sma
sma / kv.md
Created May 30, 2025 12:44
Ramblings about implementing a key value store in Dart

People always ask for the best way to store data.

Most often they don't disclose their requirements. So let's assume a) we only need to store a few megabytes of data (which easily fit into the main memory of your device), b) we have more reads than writes, c) we need only be faster than 1ms, and d) we don't need complex queries. A simple key/value store will suffice.

Here's a minimal key-value store API:

abstract class KV<T> {
  Future<T?> get(String key);
  Future<void> set(String key, T value);

Future delete(String key);

@ychoi-kr
ychoi-kr / srt.py
Created November 5, 2023 09:37
whisper scripts
# modified script from https://github.com/openai/whisper/discussions/98#discussioncomment-3725983
from datetime import timedelta
import os
import sys
import whisper
def transcribe_audio(path):
model = whisper.load_model("large")
print("Whisper model loaded.")
@eduardoflorence
eduardoflorence / main.dart
Created February 24, 2021 11:35
GetX - Sample GetMiddleware
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class GlobalMiddleware extends GetMiddleware {
final authController = Get.find<AuthController>();
@override
RouteSettings redirect(String route) {
return authController.authenticated || route == '/login'
? null
@Rex-Ferrer
Rex-Ferrer / foo_test.dart
Last active December 9, 2023 16:42
16 Tips for Widget Testing in Flutter
// https://gist.github.com/Esgrima/c0d4bff4b0d3909daf8994410cd659ce
// https://dartpad.dev/c0d4bff4b0d3909daf8994410cd659ce
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:boolean_selector/boolean_selector.dart';
// (TODO: Tip # 1) Consider making frequently used variables/values constants
const _fooConst1 = '';
const _fooConst2 = '';
@collinjackson
collinjackson / main.dart
Last active August 17, 2023 20:06
PageView example with dots indicator
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}