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 }); |
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
escolher uma cor primária | |
gerar uma paleta de: | |
- background => é o scaffoldbackground | |
- surface => tal do paper | |
- elevation overlay => | |
- surface overlay => chips & text fields, é um surface um pouco mais clarinho | |
- Error => Gera uma nova paleta, por recursividade, usando vermelho + a claridade escolhida + baseado no vermelho tudo | |
- Outline => É uma borda bem fininha e transparente,é basicamente a cor branca com pouca opacidade | |
- on surface => High|Medium|Low|Disabled emphasys |