Skip to content

Instantly share code, notes, and snippets.

View RandalSchwartz's full-sized avatar

Randal L. Schwartz RandalSchwartz

View GitHub Profile
@RandalSchwartz
RandalSchwartz / Fplay and Dplay.md
Last active June 5, 2021 22:06
fplay and dplay, for quick flexible "dart pad" tinkering

fplay and dplay

Great when you just want a quick place to play with flutter or dart.

Presumes Visual Studio Code is available from the code command.

Creates a new project in /tmp.

By default, the project name is a uuid (made into a suitable project name), preceded by either d_ for dart, or f_ for flutter. If you specify a name, that takes precedence.

@RandalSchwartz
RandalSchwartz / main.dart
Last active August 16, 2022 11:31
demonstrate "more to scroll" display
// ignore_for_file: avoid_print
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; // flutter pub add flutter_hooks
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@RandalSchwartz
RandalSchwartz / watch a series of repos
Last active October 16, 2022 02:27
update a series of git repos in a subdirectory, then see which one has the most recent commits
#!/bin/zsh
for i in */.git; do (
echo "====== $i:h ======"
cd $i:h &&
git pull
); done
for i in */.git; do
(
cd $i:h &&
@RandalSchwartz
RandalSchwartz / datetime_smart_copy_with.dart
Last active January 30, 2024 07:47
DateTime.smartCopyWith as shown in https://youtu.be/9Kp7KZsb154
extension DateTimeSmartCopyWith on DateTime {
/// Update the DateTime with the given fields,
/// using mutate mappers for selected fields.
///
/// If a field is not mentioned, and it is smaller than
/// any field mentioned, a field-specific default value is used.
///
/// If a field is not mentioned, but is not smaller than
/// any field mentioned, it is passed though from the original,
/// subject to any over-/under-flows from smaller fields as with
@RandalSchwartz
RandalSchwartz / digits.dart
Created February 2, 2024 03:39
digits using flutter_animate
class Digits extends StatelessWidget {
const Digits({super.key, this.prefix = ''});
final String prefix;
@override
Widget build(BuildContext context) => Animate(
onPlay: (controller) => controller.repeat(),
).custom(
builder: (_, double value, __) {
return Text(