This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command
$ docker-compose up -d
# To Tear Down
$ docker-compose down --volumes
// Add any other logic here as needed. | |
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin'; | |
import { CacheFirst } from 'workbox-strategies/CacheFirst'; | |
import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL'; | |
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin'; | |
import { NavigationRoute } from 'workbox-routing/NavigationRoute'; | |
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute'; | |
import { registerRoute } from 'workbox-routing/registerRoute'; |
add_filter( 'graphql_PostObjectsConnectionOrderbyEnum_values', function( $values ) { | |
$values['LIKE_COUNT'] = [ | |
'value' => 'like_count', | |
'description' => __( 'The number of likes on the post', 'wp-graphql' ), | |
]; | |
return $values; | |
} ); |
const rewire = require('rewire'); | |
const defaults = rewire('react-scripts/scripts/build.js'); | |
let config = defaults.__get__('config'); | |
config.optimization.splitChunks = { | |
cacheGroups: { | |
default: false, | |
}, | |
}; |
import 'dart:async'; | |
import 'dart:io'; | |
import 'package:flutter/material.dart'; | |
import 'package:camera/camera.dart'; | |
import 'package:path_provider/path_provider.dart'; | |
List<CameraDescription> cameras; | |
IconData getCameraLensIcon(CameraLensDirection direction) { | |
switch (direction) { |
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
void onNewCameraSelected(CameraDescription cameraDescription) async { | |
if (controller != null) { | |
await controller.dispose(); | |
} | |
controller = CameraController(cameraDescription, ResolutionPreset.high); | |
controller.addListener(() { | |
if (mounted) setState(() {}); | |
if (controller.value.hasError) { | |
showInSnackBar('Camera error ${controller.value.errorDescription}'); |
type System.Random with | |
/// Generates an infinite sequence of random numbers within the given range. | |
member this.GetValues(minValue, maxValue) = | |
Seq.initInfinite (fun _ -> this.Next(minValue, maxValue)) | |
member this.GetItems(items:_[]) = | |
Seq.initInfinite (fun _ -> items.[this.Next(0, items.Length - 1)]) | |
let r = System.Random() |
static String timeAgoSinceDate(String dateString, {bool numericDates = true}) { | |
DateTime date = DateTime.parse(dateString); | |
final date2 = DateTime.now(); | |
final difference = date2.difference(date); | |
if ((difference.inDays / 365).floor() >= 2) { | |
return '${(difference.inDays / 365).floor()} years ago'; | |
} else if ((difference.inDays / 365).floor() >= 1) { | |
return (numericDates) ? '1 year ago' : 'Last year'; | |
} else if ((difference.inDays / 30).floor() >= 2) { |
/** | |
* Disable new divi crazy crap code for CPT | |
**/ | |
function disable_cptdivi() | |
{ | |
remove_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 ); | |
} | |
add_action('init', 'disable_cptdivi'); |