This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({Key? key}) : super(key: key); | |
| // This widget is the root of your application. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:math' as math; | |
| void main() { | |
| /// Online Tool https://www.meridianoutpost.com/resources/etools/calculators/calculator-latitude-longitude-distance.php? | |
| final distance = DistanceUtils.distanceBetween(40.689202777778, -74.044219444444, 38.889069444444, -77.034502777778); | |
| print(distance); | |
| } | |
| abstract class DistanceUtils { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| void main() { | |
| /// Debounce example | |
| final debounce = debounceIt(Duration(seconds: 2)); // Or DebounceIt(...) | |
| debounce(() => print('First call')); | |
| debounce(() => print('Second call')); | |
| debounce(() => print('Third call')); | |
| debounce(() => print('Fourth call')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Checks if [source] contains all the characters of [text] in the correct order | |
| /// | |
| /// Example: | |
| /// ``` | |
| /// hasMatch('abcdef', 'adf') // true | |
| /// hasMatch('dbcaef', 'adf') // false | |
| /// ``` | |
| bool hasWildcardMatch(String source, String text) { | |
| final regexp = text.split('').join('.*'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.onbeforeunload = (e) => { | |
| return "Dude, are you sure you want to leave? Think of the kittens!"; | |
| } | |
| const bts = document.querySelectorAll("[aria-label='Delete']") | |
| const b = [...bts]; | |
| for(let bt of b) { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const selectorsToDelete = [ | |
| ".wrapper-3NnKdC.guilds-1SWlCJ", | |
| ".sidebar-2K8pFh", | |
| ".title-3qD0b-.container-1r6BKw.themed-ANHk51", | |
| ]; | |
| for(const select of selectorsToDelete) { | |
| document.querySelector(select).remove(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const regex = new RegExp('^(?=.*?[A-Z])(?=.*?[])(?=.*?[0-9]).{8,}$'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| final dynamicInstance = createInstanceOf<Foo>(); | |
| print(dynamicInstance); | |
| } | |
| T? createInstanceOf<T>() { | |
| final factories = <Type, T Function()>{ | |
| Foo: () => Foo() as T, | |
| Bar: () => Bar() as T, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| class SmoothScrollPhysics extends ScrollPhysics { | |
| const SmoothScrollPhysics({ScrollPhysics parent}) : super(parent: parent); | |
| @override | |
| SmoothScrollPhysics applyTo(ScrollPhysics ancestor) { | |
| return SmoothScrollPhysics(parent: buildParent(ancestor)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function sendText(scriptText) { | |
| const lines = scriptText.split("\n"); | |
| for (const line of lines) { | |
| if (line.trim() != "") { | |
| console.log(lines); | |
| window.InputEvent = window.Event || window.InputEvent; | |
| const event = new InputEvent("input", { bubbles: true }); |