This file contains 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
/** | |
* Selects light or dark color for foreground (mainly text) based on background color | |
* @param bgColor Background color to evaluate | |
* @param lightColor Light foreground color (defaults to white) | |
* @param darkColor Dark foreground color (defaults to black) | |
* @returns Light or dark color based on background color | |
* @see https://stackoverflow.com/a/41491220 | |
*/ | |
function pickTextColorBasedOnBgColorAdvanced(bgColor: string, lightColor = '#FFFFFF', darkColor = '#000000'): string { | |
const color = (bgColor.startsWith('#')) ? bgColor.substring(1, 7) : bgColor; |
This file contains 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
@Component({ | |
template: ` | |
<div *ngIf="data$ | async as data"> | |
{{ data }} | |
</div> | |
` | |
}) | |
export class SearchComponent implements OnInit { | |
private dataService = inject(DataService); |
This file contains 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
/// Originally by Simon Lightfoot | |
extension WhenAsyncSnapshot<T> on AsyncSnapshot<T> { | |
R when<R>({ | |
R Function()? empty, | |
R Function(dynamic error, StackTrace? stackTrace)? error, | |
R Function()? loading, | |
R Function(T value)? data, | |
}) { | |
if (hasData && data != null) // If we have data then lets display it no-matter what! |
This file contains 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
# Located in /.well-known directory, next to a apple-app-site-association.json file | |
RewriteEngine On | |
RewriteBase /.well-known/ | |
RewriteRule ^apple-app-site-association$ apple-app-site-association.json [NC,L] |
This file contains 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
# Windows debloater by https://github.com/Sycnex/Windows10Debloater | |
iwr -useb https://git.io/debloat|iex |
This file contains 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(MyApp()); | |
const totalColorsToShow = 50; | |
const startColor = Colors.red; | |
const finalColor = Colors.green; | |
class MyApp extends StatelessWidget { | |
@override |
This file contains 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 InteractiveViewerOverlay extends StatefulWidget { | |
final Widget child; | |
final double maxScale; | |
const InteractiveViewerOverlay({ | |
Key key, | |
@required this.child, | |
this.maxScale, |
This file contains 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
SELECT JSON_PRETTY(JSON_ARRAYAGG( | |
JSON_OBJECT('code', code, 'name', name, 'iso3', iso3, 'numcode', numcode, 'city', city) | |
)) FROM country; |
This file contains 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
node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --aot |
This file contains 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
@Component({ ... }) | |
export class Mva10SelectFieldComponent { | |
constructor( private elementRef: ElementRef ) { } | |
onClickOut(targetElement?: HTMLElement): void { | |
if (!targetElement) { return; } | |
const clickedInside = this.elementRef.nativeElement.contains(targetElement); | |
if (!clickedInside) { | |
// Clicked outside component! |
NewerOlder