Skip to content

Instantly share code, notes, and snippets.

View lukepighetti's full-sized avatar
🦞

Luke Pighetti lukepighetti

🦞
View GitHub Profile
@lukepighetti
lukepighetti / rounded_rectangle.dart
Created May 4, 2023 20:07
Boring RoundedRectangle with platform aware superellipse corners
import 'dart:io';
import 'package:figma_squircle/figma_squircle.dart';
import 'package:flutter/widgets.dart';
class RoundedRectangle extends StatelessWidget {
const RoundedRectangle({
super.key,
this.radius = 10,
this.height,
import 'package:app/extensions.dart';
import 'package:flutter/material.dart';
class AutoFillText extends StatelessWidget {
const AutoFillText(
this.text, {
super.key,
this.textStyle,
this.minFontSize = 18,
});
@lukepighetti
lukepighetti / app_store.dart
Last active April 18, 2023 18:23
A crusty but nice way to deal with ChangeNotifier stores in dart
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '/app/store_architecture.dart';
import '/feedback/feedback_store.dart';
import '/par/par_store.dart';
import '/settings/settings_binding_observer.dart';
import '/settings/settings_store.dart';
extension on WidgetTester {
Future<void> launchApp() async {
await app.main();
await pumpAndSettle();
}
Future<void> clearState() async {
await SharedPreferences.getInstance().then((it) => it.clear());
}
@lukepighetti
lukepighetti / server.py
Created March 21, 2023 15:55
A very basic mock python server
# flask --app server run
from dataclasses import dataclass, asdict
from typing import Generic, List, TypeVar
from flask import Flask
app = Flask(__name__)
T = TypeVar("T")
@lukepighetti
lukepighetti / .zshrc
Created March 3, 2023 15:41
marksman environment for note taking https://youtu.be/8GQKOLh_V5E
# launch daily notes with `notes`
# launch specific notes with `notes woodworking`
# this is a cloud synced file, so it's live on all my devices
function notes(){
SUBJECT="${1:=daily}"
if [ -z "$SUBJECT" ]
then
(cd ~/Documents/notes && hx NOTES.md)
else
(cd ~/Documents/notes && hx "${SUBJECT:u}.md" NOTES.md)
http://bloodgate.com/perl/graph/manual/
https://twitter.com/luke_pighetti/status/1624102015142965274
https://github.com/maaslalani/slides

I was trying to do some performance profiling of our production app and I noticed a certain function was taking a lot more time than I expected (350ms vs 1ms), so I started to dig deeper. In doing so, it looked like if I changed that function from a Future<String> to a String with no other code changes (it could have been written as a FutureOr), the execution time of that code branch reduced to expected levels.

I posted about this on Twitter and created a reproduction.

https://twitter.com/luke_pighetti/status/1630255285372633089?s=20

This code runs in a fresh Flutter app on iOS Simulator.

It almost looks like a flurry of concurrent Futures are queueing up and delaying other futures.

@lukepighetti
lukepighetti / config.toml
Last active January 13, 2025 18:32
Helix – tree file picker... TODAY?!?
[keys.normal]
C-f = [":new", ":insert-output lf-pick", ":theme default", "select_all", "split_selection_on_newline", "goto_file", "goto_last_modified_file", ":buffer-close!", ":theme tokyonight_storm"]
@lukepighetti
lukepighetti / ultrawide-simple.js
Created February 17, 2023 02:23
My Amethyst Ultrawide Layout
const centerColumnWidthFactor = 0.4;
// Prioritizes center with adjustable width factor
// Fills column left, then right
// Then splits right column vertically
// Then splits left column vertically
function layout() {
return {
name: "Ultrawide Simple",
getFrameAssignments: (windows, screenFrame) => {