This guide assumes you have Docker Desktop installed (or something similar).
Most probably you'll also need Composer, which usually require PHP.
| /// FNV-1a 64bit hash algorithm optimized for Dart Strings | |
| int fastHash(String string) { | |
| var hash = 0xcbf29ce484222325; | |
| var i = 0; | |
| while (i < string.length) { | |
| final codeUnit = string.codeUnitAt(i++); | |
| hash ^= codeUnit >> 8; | |
| hash *= 0x100000001b3; | |
| hash ^= codeUnit & 0xFF; |
This guide assumes you have Docker Desktop installed (or something similar).
Most probably you'll also need Composer, which usually require PHP.
| import 'dart:async'; | |
| import 'package:flutter/cupertino.dart'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/scheduler.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatefulWidget { | |
| _MyAppState createState() => _MyAppState(); |
| <?php | |
| /** | |
| * Determine if a black or white foreground color will have a better contrast | |
| * ratio for a given background color | |
| * | |
| * @param string|int $bg_r A hex representation of the color | |
| * or the value of the red color 0-255 | |
| * @param int $bg_g The value of the green color 0-255 | |
| * @param int $bg_b The value of the blue color 0-255 | |
| * |
| #!/usr/bin/env bash | |
| git diff --name-status --exit-code >/dev/null | |
| [[ "$?" == "1" ]] && { echo " --- found uncommited changes"; exit 1; } | |
| echo "removing all git files and packaging .git dir into an archive" | |
| set -e | |
| git ls-files | while read f; do test -f "$f" && echo "$f"; done | xargs -n 30 -- rm -f | |
| find . -type d -empty -delete | |
| tar czf bare.tar.gz .git | |
| rm -rf .git | |
| echo "#!/bin/bash" > revive.sh |
| import EventEmitter from 'EventEmitter'; // from https://www.npmjs.com/package/event-emitter | |
| const create = Object.create; | |
| const defineProperties = Object.defineProperties; | |
| const _loggers = new Map(); | |
| // Use a [Logger] to log debug messages. | |
| // | |
| // [Logger]s are named using a hierarchical dot-separated name convention. |
| // Author: Evo Stamatov | |
| // September 2020 | |
| // | |
| // Python implementation by Will Hardy (December 2008) | |
| // @source: https://github.com/simonluijk/django-invoice/blob/7d136e8b732aa76bab3cc4b5d81a8ce2734571fc/invoice/utils/friendly_id.py | |
| import 'dart:math' as math; | |
| /// Generates and decodes an unique invoice id, which can use characters | |
| /// to shorten its length. |
| String filterShortcodes(String input, | |
| {String opening = '[', String closing = ']'}) { | |
| assert(opening.runes.length == 1); | |
| assert(closing.runes.length == 1); | |
| final openingRune = opening.runes.first; | |
| final closingRune = closing.runes.first; | |
| bool filter = false; | |
| final buf = StringBuffer(); | |
| for (final rune in input.runes) { | |
| if (filter == false && rune == openingRune) { |
| #!/bin/bash | |
| # Requirements | |
| # - bc - for some math | |
| # - convert - from ImageMagick (or any alternative that provides `convert` util with -resize param) | |
| # - optipng - to optimize the output from convert | |
| # - jq - to read Contents.json if no GEN_SIZES | |
| # Usage: | |
| # ------ |