Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
jtmuller5 / ai-tools.code-snippets
Last active November 14, 2024 21:52
Snippet for creating tools for AI function calling
"AI Tool Template": {
"prefix": "aiTool",
"body": [
"import { ToolResult } from './AITools';",
"import { tool } from 'ai';",
"import { z } from 'zod';",
"",
"export interface ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}Params {",
" input: string;",
"}",
@jtmuller5
jtmuller5 / date_utils.dart
Created October 25, 2024 14:28
DateTime extension for formatting dates seven ways to Sunday ("EEEE") using the intl library
import 'package:intl/intl.dart';
// https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html
extension DateTimeFormattingExtensions on DateTime {
// Existing methods
String get day => DateFormat('d').format(this); // e.g., "6"
String get abbrWeekday => DateFormat('E').format(this); // e.g., "Thu"
String get weekday => DateFormat('EEEE').format(this); // e.g., "Thursday"
String get abbrStandaloneMonth => DateFormat('LLL').format(this); // e.g., "Jun"
String get standaloneMonth => DateFormat('LLLL').format(this); // e.g., "June"
@jtmuller5
jtmuller5 / android.rb
Last active November 7, 2024 15:58
Android and iOS Fastfiles for Flutter App
# android/fastlane/Fastfile
update_fastlane
default_platform(:android)
platform :android do
lane :bump_version_code do
versionCode = File.read("metadata/versionCode").to_i
versionCode = versionCode + 1
@jtmuller5
jtmuller5 / tasks.json
Created October 3, 2024 23:57
One-click Flutter build_runner
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Runner",
"type": "shell",
"command": "flutter pub run build_runner build --delete-conflicting-outputs",
"group": {
"kind": "build",
"isDefault": true
@jtmuller5
jtmuller5 / emotional-gemma.ipynb
Created September 5, 2024 12:27
emotional-gemma.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jtmuller5
jtmuller5 / main.dart
Last active September 27, 2023 21:55
List Transitions
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@jtmuller5
jtmuller5 / main.dart
Last active October 12, 2023 07:48
SwiftUI in Flutter
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
@jtmuller5
jtmuller5 / main.dart
Created August 18, 2023 01:20
xenial-performance-6792
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
import 'package:json_annotation/json_annotation.dart';
part 'gpt_usage.g.dart';
@JsonSerializable(explicitToJson: true)
class GptUsage {
@JsonKey(name: 'prompt_tokens')
int promptTokens;
import 'package:json_annotation/json_annotation.dart';
part 'gpt_choice_message.g.dart';
@JsonSerializable(explicitToJson: true)
class GptChoiceMessage{
String role;
String content;