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)
View .htaccess
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
# BEGIN MAINTENANCE MODE | |
# ADD your IP address to gain access. Local IPS for local testing | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REMOTE_ADDR} !^192\.168\.0\.0 | |
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 | |
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f | |
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f | |
RewriteCond %{SCRIPT_FILENAME} !maintenance.html | |
RewriteRule ^.*$ /maintenance.html [R=503,L] |
View retry.js
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
/** | |
* @example | |
*.try { | |
* const result = await retry((attempt) => { | |
* if ( Math.ceil(Math.random() >= .5) ) { | |
* return 'ok'; | |
* } | |
* | |
*. console.log('-> nope'); | |
* throw new Error('Failed after ' + attempt + ' tries'); |
View watch.js
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
/** | |
* @example | |
* const item = watch({}, (value, prop, source) => { | |
* if (prop === 'foo' && !value) { | |
* return 'default_value'; | |
* } | |
* | |
* if (prop === 'baz') { | |
* return 'nope'; | |
* } |
View reactivity.js
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 debounce from 'lodash.debounce'; | |
/** | |
* @example | |
* import { reactive, watch } from './reactivity'; | |
* | |
* const r1 = reactive({ isReady: false }) | |
* const r2 = reactive({ x: 1 }) | |
* | |
* setTimeout(() => { |
View tailwind.config.js
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
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, |
View snippets.md
View optional.js
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
/** | |
* Copy properties from source to target. | |
* @param target | |
* @param source | |
*/ | |
function copyProps(target, source) { | |
const properties = Object.getOwnPropertyNames(source); | |
properties | |
.concat(Object.getOwnPropertySymbols(source)) |
View functions.php
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
<?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 |
View sass-explode.scss
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
// @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)); | |
} |
View capture.html
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
<!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'; |
NewerOlder