Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lukepighetti's full-sized avatar
🦞

Luke Pighetti lukepighetti

🦞
View GitHub Profile
@lukepighetti
lukepighetti / .zshrc
Last active April 9, 2024 11:59
zsh functions I use for Helix / Flutter development
function flutter-watch(){
local PID_FILE="/tmp/tf$$.pid"
tmux new-session \;\
send-keys "flutter run --pid-file=$PID_FILE" Enter \;\
split-window -v \;\
send-keys "npx -y nodemon -e dart -x \"cat $PID_FILE | xargs kill -s USR1\"" Enter \;\
resize-pane -y 5 -t 1 \;\
select-pane -t 0 \;
rm $PID_FILE;
}
@lukepighetti
lukepighetti / config.toml
Last active March 28, 2024 06:44
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 / .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)
@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();
import '/features/architecture/logging.dart';
class CachedQuery<T> {
final Duration invalidation;
final Future<T> Function(String key) fn;
CachedQuery(
this.fn,
this.invalidation,
);
@lukepighetti
lukepighetti / markers.dart
Created January 30, 2024 15:15
Extracting markers for YouTube channels in Dart
import 'dart:io';
import 'package:xml/xml.dart';
Future<void> main() async {
final str = File('./markers.fcpxmld/Info.fcpxml').readAsStringSync();
final xml = XmlDocument.parse(str);
final markers = xml.findAllElements('marker');
for (final x in markers) {
extension on WidgetTester {
Future<void> launchApp() async {
await app.main();
await pumpAndSettle();
}
Future<void> clearState() async {
await SharedPreferences.getInstance().then((it) => it.clear());
}
import 'package:flutter/material.dart';
class Tappable extends StatefulWidget {
const Tappable({
super.key,
required this.onPressed,
required this.child,
});
final VoidCallback? onPressed;
@lukepighetti
lukepighetti / example.dart
Last active December 7, 2023 14:09
Another logger
class MyService {
final _log = Logger('MyService');
void init() {
try {
// operation
_log("initialized");
} catch(e, stackTrace){
_log.e("init() error", e, stackTrace);
}
@lukepighetti
lukepighetti / signing-google-sign-in.md
Last active October 29, 2023 01:51
Finally figured out how to get Google Sign In working. I needed to add my debug keys to Firebase https://twitter.com/luke_pighetti/status/1677328491216359434?s=20

Figured it out! You need to add:

  1. Debug signing keys
  2. Release signing keys
  3. PlayStore signing keys

Use JDK from Android Studio

  • export JAVA_HOME='/Applications/Android Studio.app/Contents/jbr/Contents/Home/'