wp rewrite flush
- Flush rewrite ruleswp media image-size
- List registered image sizeswp media regenerate --yes
- Regenerate all mediawp search-replace https://old.domain.tld https://new.domain.tld
- Replace an old domain in databasewp db export --add-drop-table
- Backup databasewp db import backup.sql
- Import backup in databasewp maintenance-mode activate
- Maintenance mode (usewp maintenance-mode deactivate
to return to normal)wp rewrite list
- Show rootes listwp search-replace "old_post_type" "new_post_type" wp_posts --include-columns="guid,post_type"
- Rename post_type (use--dry-run
to check what it will do)
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
/** | |
* Memoization helper. | |
* @param fn | |
* @param context | |
* @return Function | |
*/ | |
export default function memoize(fn, context = null) { | |
const cache = {}; | |
return (...args) => { |
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
/** | |
* Define unwritable property to the given object. | |
* @example | |
* var test = {}; | |
* test = definePropertyFreeze(test, 'foo', 'bar'); | |
* test = definePropertyFreeze(test, 'baz', {bat: 'bral'}); | |
* test = definePropertyFreeze(test, 'bot', [1, 2]); | |
* // then | |
* test.bat = 'ok'; // works | |
* test.foo = 'nok'; // not working, test.foo return 'bar' |
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
/** | |
* Returns the distance bewteen 2 coordinates. | |
* @param {Object} from - Object with lat and lng | |
* @param {Object} to - Object with lat and lng | |
* @return {float} | |
*/ | |
function distance(from, to) { | |
const {atan2, cos, sqrt, sin} = Math; | |
// @note - radius of the planet earth in meters | |
const R = 6378137; |
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
/** | |
* Freeze given value recursively if needed. | |
* @param obj | |
* @return {*} | |
*/ | |
export default function freezeRecursive(obj) { | |
Object.freeze(obj); | |
if (obj === undefined) { | |
return obj; |
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
<!DOCTYPE html> | |
<head> | |
<script type='text/javascript'> | |
window.onload = function () { | |
var video = document.getElementById('videoId'); | |
var canvas = document.getElementById('canvasId'); | |
var img = document.getElementById('imgId'); | |
video.addEventListener('play', function () { | |
canvas.style.display = 'none'; |
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
// @function explode() -- split a string into a list of strings | |
// {string} $string: the string to be split | |
// {string} $delimiter: the boundary string | |
// @return {list} the result list | |
@function explode($string, $delimiter) { | |
$result: (); | |
@if $delimiter == "" { | |
@for $i from 1 through str-length($string) { | |
$result: append($result, str-slice($string, $i, $i)); | |
} |
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
<?php | |
/** | |
* Recursively get taxonomy hierarchy | |
* | |
* @source http://www.daggerhart.com/wordpress-get-taxonomy-hierarchy-including-children/ | |
* @param string $taxonomy | |
* @param int $parent - parent term id | |
* | |
* @return array |
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
/** | |
* Copy properties from source to target. | |
* @param target | |
* @param source | |
*/ | |
function copyProps(target, source) { | |
const properties = Object.getOwnPropertyNames(source); | |
properties | |
.concat(Object.getOwnPropertySymbols(source)) |
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 fs = require('fs'); | |
const colors = require('tailwindcss/colors'); | |
const themeJson = JSON.parse(fs.readFileSync('./theme.json')); | |
module.exports = { | |
theme: { | |
extend: { | |
colors: useThemeJSONWith({ | |
// brand | |
primary: colors.purple, |