Skip to content

Instantly share code, notes, and snippets.

View Luckey-Elijah's full-sized avatar
🦢
Working from home

Elijah Luckey Luckey-Elijah

🦢
Working from home
View GitHub Profile
@Luckey-Elijah
Luckey-Elijah / main.dart
Created December 16, 2024 18:40
Simple Theme Picker
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@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;
}
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@Luckey-Elijah
Luckey-Elijah / cupertino_picker.dart
Last active December 26, 2024 14:32
A useful OverlayPortal widget wrapper for building based on the anchor/target's position.
import 'positioned_overlay_builder.dart';
import 'package:flutter/cupertino.dart';
class Example extends StatefulWidget {
const Example({super.key});
@override
State<Example> createState() => _ExampleState();
}
const k = {
"admin-restricted-operation": "This operation is restricted to administrators only.",
"argument-error": "",
"app-not-authorized": "This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.",
"app-not-installed": "The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.",
"captcha-check-failed": "The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.",
"code-expired": "The SMS code has expired. Please re-send the verification code to try again.",
"cordova-not-ready": "Cordova framework is not ready.",
"cors-unsupported": "This browser is not supported.",
"credential-already-in-use": "This credential is already associated with a different user account.",

dpad.dart

dpad is your local dart scripting environment. This is a simple guide to start using dart scripts across your machine.

Requirements

  • dart installed (I recommend using puro to manage dart/flutter versions)
  • bash/zsh-like environment (this is likely possible in other terminals but idk how to set that up and am too lazy to tell you)

Setup

@Luckey-Elijah
Luckey-Elijah / main.dart
Created August 28, 2023 20:46
discord-like-commands
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
import 'dart:math';
import 'package:benchmark_harness/benchmark_harness.dart';
void main(List<String> args) {
final random = Random();
ShapeType randomShapeType() => ShapeType.values[random.nextInt(4)];
double randomSize() => random.nextDouble();
@Luckey-Elijah
Luckey-Elijah / main.dart
Last active September 25, 2024 08:26
Dart Loop Benchmarking
// Adding this line so we can perform the variable assignment: num eachElement = 0;
// ignore_for_file: unused_local_variable
import 'dart:collection';
import 'dart:math';
void main(List<String> args) {
final list = UnmodifiableListView(
List<int>.generate(200000000, (index) => index),
);
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: EyesThatFollow()));
class EyesThatFollow extends StatefulWidget {
const EyesThatFollow({super.key});
@override
State<EyesThatFollow> createState() => _EyesThatFollowState();
}