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
#!/bin/bash | |
# This script assumes you have ssh access to a remote server | |
# Both databases are backed up to sql files in the same directory | |
# this script is executed from. | |
# Usage: | |
# 1. Make sure this file is executable with `chmod +x mysqlsync` | |
# 2. Set the credentials for the variables at the top | |
# (Remember, no spaces around the '=' sign) | |
# 3. Run it from a directory where you'd like the backup files to go: |
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 | |
/** | |
* NOTE: This gist is very old. You might want to check out recent forks | |
* like this one: https://github.com/Alexlytle/Wordpress_custom_route/blob/main/Wordpress_Custom_route.php | |
* (thanks @Alexlytle) If you have an improvement to this gist, please | |
* post a link in a comment for others who might benefit. Thanks! | |
* | |
* A class to create simple custom routes. | |
* |
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 { useEffect, useState } from "react"; | |
function useDevBgImage(src) { | |
const [bgTop, setBgTop] = useState(0); | |
const [opacity, setOpacity] = useState(100); | |
useEffect(() => { | |
document.getElementById('root').style.opacity = String(opacity / 100); | |
}, [opacity]); |
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
{# | |
Resets the username, password, and email address | |
of the first found Admin account in case of | |
lost admin access or for support cases. | |
#} | |
{% set values = { | |
username: 'me', | |
password: craft.app.security.hashPassword('mypassword'), | |
email: 'me@site.com', | |
passwordResetRequired: 0 |
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> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Contact Form Plugin Example with Axios</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script> | |
</head> | |
<body> | |
<!-- |
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 | |
namespace modules; | |
use Craft; | |
/** | |
* MAMP Helper class. | |
* File: /modules/MampHelper.php | |
* | |
* MySQL database backups triggered from the Craft 3 Control Panel fail because, |
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
/** | |
* Returns the number rounded to the nearest interval. | |
* Example: | |
* | |
* roundToNearest(80, 100); // 100 | |
* roundToNearest(25, 15); // 30 | |
* | |
* @param {number} value The number to round | |
* @param {number} interval The numeric interval to round to | |
* @return {number} |
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 | |
use yii\base\Event; | |
use yii\base\Module; | |
use yii\mail\BaseMailer; | |
use yii\mail\MailEvent; | |
/** | |
* In case of emergency, break email. :) | |
* |
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 | |
use craft\base\Element; | |
use craft\db\Query; | |
use craft\db\Table; | |
use craft\elements\Asset; | |
use craft\elements\Entry; | |
use craft\errors\ImageException; | |
use craft\helpers\Assets; | |
use craft\helpers\FileHelper; |
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 | |
// File: modules\Module.php | |
namespace modules; | |
use Craft; | |
use craft\base\Element; | |
use craft\elements\Category; | |
use craft\elements\Entry; | |
use yii\base\Event; |
NewerOlder