Skip to content

Instantly share code, notes, and snippets.

@Luckey-Elijah
Luckey-Elijah / collection.dart
Last active November 8, 2024 23:12
A collection class that is helpful for mapping pocketbase collections to dart code repositories.
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:pocketbase/pocketbase.dart' as pb;
mixin ToJson implements pb.Jsonable {
String get id;
DateTime get created;
DateTime get updated;
pb.RecordModel get recordModel;
}
@Geczy
Geczy / readme.md
Last active March 27, 2025 07:47
Migrate Coolify to a new server
@lukepighetti
lukepighetti / paywall_showing_schedule.dart
Created March 4, 2024 02:08
My way of showing a paywall every day for a few days, then every week, then every two weeks. Good for about a year.
import 'package:collection/collection.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '/architecture/let.dart';
import '/membership/membership_state.dart';
import '/membership/membership_tasks.dart';
import '/telemetry/analytics.dart';
Future<void> appOpenAction() async {
$analytics.vglAppOpenActionRequested();
@sma
sma / sqlite_kv.dart
Created January 26, 2024 13:19
A simple key-value store w/persistent sqlite3 database.
/// A simple key-value store w/persistent sqlite3 database.
class KV {
KV._(this._db);
final Database _db;
static Future<KV> open(String name) async {
return KV._(sqlite3.open(name)..execute('create table if not exists kv (k text primary key, v jsonb)'));
}
Future<Object?> get(String key) async {
@zenorocha
zenorocha / invite.ics
Last active September 19, 2024 15:28
Resend with iCal
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
SUMMARY:Access-A-Ride Pickup
DTSTART;TZID=America/New_York:20130802T103400
DTEND;TZID=America/New_York:20130802T110400
LOCATION:1000 Broadway Ave.\, Brooklyn
DESCRIPTION: Access-A-Ride to 900 Jay St.\, Brooklyn
STATUS:CONFIRMED
@thekitchenscientist
thekitchenscientist / gist:56969191bd2f33849fb2dfa10cfae0d9
Created October 14, 2023 17:30
Recreation of textfx.withgoogle.com locally using dolphin-2.1-mistral-7b, llama-cpp-python and streamlit
# -*- coding: utf-8 -*-
"""
Prompts by Google https://github.com/google/generative-ai-docs/tree/main/demos/palm/web/textfx
@author: thekitchenscientist and Bing Chat (conversion of prompts and basic app framework)
"""
class TextFX:
# Initialize the list attribute with an empty list
@rodydavis
rodydavis / flutter_infinite_canvas.dart
Last active April 9, 2024 15:04
Flutter infinite canvas with InteractiveViewer + CustomMultiChildLayout
import 'package:flutter/material.dart';
import 'package:vector_math/vector_math_64.dart' hide Colors;
void main() {
final controller = WidgetCanvasController([
WidgetCanvasChild(
key: UniqueKey(),
offset: Offset.zero,
size: const Size(400, 800),
child: Scaffold(
@rodydavis
rodydavis / flutter_canvas_demo.dart
Last active December 23, 2022 23:18
Flutter Canvas Demo
import 'package:flutter/material.dart';
void main() {
runApp(const StoryBoardExample());
}
class StoryBoardExample extends StatelessWidget {
const StoryBoardExample({super.key});
@override
@steveruizok
steveruizok / cache.ts
Last active March 31, 2023 14:43
weak map gist
export class Cache<T extends object, K> {
items = new WeakMap<T, K>()
get<P extends T>(item: P, cb: (item: P) => K) {
if (!this.items.has(item)) {
this.items.set(item, cb(item))
}
return this.items.get(item)!
}
@lukepighetti
lukepighetti / Fastfile
Last active August 22, 2022 08:17
How I build and release Flutter side projects on iOS https://twitter.com/luke_pighetti/status/1530156415611969537
default_platform(:ios)
APPLE_ISSUER_ID = ENV["APPLE_ISSUER_ID"]
APPLE_KEY_CONTENT = ENV["APPLE_KEY_CONTENT"]
APPLE_KEY_ID = ENV["APPLE_KEY_ID"]
DEVELOPER_APP_ID = ENV["DEVELOPER_APP_ID"]
DEVELOPER_APP_IDENTIFIER = ENV["DEVELOPER_APP_IDENTIFIER"]
GIT_AUTHORIZATION = ENV["GIT_AUTHORIZATION"]
GITHUB_RUN_NUMBER = ENV["GITHUB_RUN_NUMBER"]
PROVISIONING_PROFILE_SPECIFIER = ENV["PROVISIONING_PROFILE_SPECIFIER"]