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
This is a collection of my most used or most useful PHP and JS snippets | |
**Disclaimer, I didn't write most of these - I just curated them over the years** |
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 | |
// Add the following code snippet to the PHP section in the MainWP Custom Dashbaord plugin | |
add_filter( 'mainwp_updatescheck_sendmail_at_time', 'mycustom_mainwp_updatescheck_sendmail_at_time', 10, 1 ); | |
function myhook_mainwp_updatescheck_sendmail_at_time( $hour ) { | |
$hour = '12:00'; // send email notifactions after 12:00 | |
return $hour; | |
} |
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
#facebook marketplace | |
from selenium import webdriver | |
from time import sleep | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as EC | |
from pymongo import MongoClient | |
class App: |
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 | |
// Available parameters: url, name, wpadmin, unique_id, groupids, ssl_verify, ssl_version, http_user, http_pass | |
$params = array( | |
'url' => 'demosite.com', | |
'name' => 'Site Friendly Name', | |
'wpadmin' => 'adminusername', | |
'unique_id' => 'unique_id' | |
); |
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 | |
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin | |
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations | |
// More about the plugin: https://mainwp.com/mainwp-customisations/ | |
add_filter( 'mainwp_client_report_pdf_page_format', 'mycustom_pdf_page_format', 10 , 1 ); | |
function mycustom_pdf_page_format( $format = '' ) { | |
return 'A4'; | |
} |
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
/** | |
* Add this to the child theme's functions.php file. | |
*/ | |
add_filter( 'fl_builder_loop_query_args', function( $query_args ){ | |
$today = date( 'd.m.Y', time() ); | |
// Past ( today > start_date ) | |
if ( 'PAST_POST_MODULE_ID_HERE' == $query_args[ 'settings' ]->id ) { | |
$query_args[ 'meta_query' ] = array( | |
'key' => 'end_date', |
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
#!/usr/bin/env bash | |
set -xu | |
RUBY_VERSION=2.4.1 | |
LIBSSL_VERSION=$(dpkg -s libssl1.0.0 | grep -i ^version | awk '{print $2;}') | |
apt-get update -y | |
apt-get upgrade -y | |
apt-get install -y software-properties-common python-software-properties vim build-essential git python-setuptools ruby-build libssl-dev=${LIBSSL_VERSION} |
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
Cross IP Settings | |
Maximum simultaneous requests 0 Default: 4 | |
Minimum delay between requests (milliseconds) 50 Default: 200 | |
IP Settings | |
Maximum simultaneous requests per ip 0 Default: 1 | |
Minimum delay between requests to the same ip (milliseconds) 100 Default: 1000 | |
Frontend request Settings | |
Maximum simultaneous sync requests 24 Default: 8 |
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 | |
wp core download --version=4.5 | |
wp core config --dbname=$1 --dbuser=root --dbhost=127.0.0.1 | |
wp db create | |
wp core install --skip-email --title="$1" --admin_user="shawn" --admin_password="shawn" --admin_email=shawn@actionable.co --url=http://wcroc.dev/ | |
wp theme install simone --activate | |
wp plugin delete hello | |
wp plugin install any-ipsum; | |
wp plugin install advanced-custom-fields --version=4.4.0 --activate | |
wp plugin install tinymce-advanced --activate |
NewerOlder