Skip to content

Instantly share code, notes, and snippets.

@simongcc
simongcc / index.php
Created Jan 3, 2019 — forked from johndyer/index.php
Gutenberg Shortcode Block with Live Preview
View index.php
<?php
/**
* Plugin Name: JD Gutenberg Shortcode Preview
* Description: Live shortcode previews in Gutenberg
* Author: johndyer
* Version: 1.0.0
*
*/
// Exit if accessed directly.
@srdjan-jcc
srdjan-jcc / wpml-ubermenu.php
Last active Aug 10, 2020
Ubermenu WPML menu sync
View wpml-ubermenu.php
<?php
/**
* Ubermenu Multilingual
*
* @package wpml
* @author OnTheGoSystems
* @copyright 2018 OTGS
* @license GPL-2.0+
*
* @wordpress-plugin
@pento
pento / php-block.js
Last active Mar 23, 2021
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
View php-block.js
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@johndyer
johndyer / index.php
Last active Oct 13, 2020
Gutenberg Shortcode Block with Live Preview
View index.php
<?php
/**
* Plugin Name: JD Gutenberg Shortcode Preview
* Description: Live shortcode previews in Gutenberg
* Author: johndyer
* Version: 1.0.0
*
*/
// Exit if accessed directly.
@woogists
woogists / wc-change-placeholder-image.php
Last active Nov 16, 2018
[Theming Snippets] Change the placeholder image
View wc-change-placeholder-image.php
/**
* Change the placeholder image
*/
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src( $src ) {
$upload_dir = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
// replace with path to your image
$src = $uploads . '/2012/07/thumb1.jpg';
@heiswayi
heiswayi / fm.php
Created Oct 25, 2017
Single PHP File Manager Script - Screenshot: https://i.imgur.com/4OtrKUz.png
View fm.php
<?php
/**
* File Manager Script
*/
// Default language ('en' and other from 'filemanager-l10n.php')
$lang = 'en';
// Auth with login/password (set true/false to enable/disable it)
$use_auth = true;
@Shourai
Shourai / namecheap SSL.md
Created Oct 21, 2017
Letsencrypt SSL certificate with namecheap hosting
View namecheap SSL.md

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.

@rob-smallshire
rob-smallshire / macOS-in-virtualbox.md
Last active Apr 1, 2021
Notes on getting macOS Sierra running in Virtualbox on a Windows 10 host
View macOS-in-virtualbox.md

On Mac

Download, but don't run, the Sierra installer from the Mac App Store. This places the installer at /Applications/Install\ macOS\ Sierra.app/.

Now run the following commands to build a suitable VM image from the installer:

git clone https://github.com/jonanh/osx-vm-templates
cd osx-vm-templates/packer
sudo ../prepare_iso/prepare_vdi.sh -D DISABLE_REMOTE_MANAGEMENT -o macOS_10.12.vdi /Applications/Install\ macOS\ Sierra.app/ .
@giovanigenerali
giovanigenerali / postfix-gmail-macos.md
Last active Jan 18, 2021
Postfix Gmail relay on macOS Sierra & macOSHigh Sierra
View postfix-gmail-macos.md

Postfix Gmail relay on macOS Sierra & macOSHigh Sierra

1 - Create a file to store our credentials:

sudo vim /etc/postfix/sasl_passwd

2 - Add something like this:

View gist:9ab45323c551cd8fb21ecbb01ba85efb
#htaccess apache .htaccess file notes, last tested in Apache 2.4.26
#################
# Disable index
#################
Options -Indexes
#################
# SSI Support
#################