Skip to content

Instantly share code, notes, and snippets.

public class Jeroo {
private int row;
private int column;
private int flowers;
public Jeroo() {}
public Jeroo(int flowers) {}
public Jeroo(int row, int col) {}
public Jeroo(int row, int col, int flowers) {}
kellenmace / class-download-remote-image.php
Last active Feb 1, 2021
Download and Insert a Remote Image File into the WordPress Media Library
View class-download-remote-image.php
* This class handles downloading a remote image file and inserting it
* into the WP Media Library.
* Usage:
* $download_remote_image = new KM_Download_Remote_Image( $url );
* $attachment_id = $download_remote_image->download();
Shelob9 / serve-side-block.js
Last active Apr 16, 2021
Example Gutenberg block with server-side rendering. Gutenberg edit() block creates interface. Gutenberg saves settings automatically, the PHP function passed as `render_callback` to `register_block_type` is used to create HTML for front-end rendering of block.
View serve-side-block.js
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const el = wp.element.createElement;
registerBlockType( 'hiRoy/serverSide', {
title: __( 'Server Side Block', 'text-domain' ),
icon: 'networking',
category: 'common',
attributes: {
jbasdf / canvas_lti_variables
Created Nov 11, 2017
All Canvas LTI Variables for substitution
View canvas_lti_variables
context_title: "$Context.title",
com_instructure_post_message_token: "$com.instructure.PostMessageToken",
com_instructure_assignment_lti_id: "$",
com_instructure_originality_report_id: "$",
com_instructure_submission_id: "$",
com_instructure_file_id: "$",
course_offering_sourced_id: "$CourseOffering.sourcedId",
context_id: "$",
context_sourced_id: "$Context.sourcedId",
message_document_target: "$Message.documentTarget",
M165437 / ScheduleList.php
Last active Feb 20, 2021
PHP Artisan command that lists all scheduled tasks: php artisan schedule:list (Credit:
View ScheduleList.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
class ScheduleList extends Command
cfebs /
Last active Aug 19, 2019
setup a vbox ubuntu server with host only adapter

Virtualbox dev environment w/ static IP

I can never find a great guide on this stuff, so these are more like notes to myself.

The goal here is to have a virtualbox running more or less headless. An ssh client is used separately to actually use the machine. I've found it to be fantastic for a quick dev setup.

lets go

Assumes you have a vbox setup with Ubuntu server (this will work for 16.04) ready to go.

petertwise /
Last active May 18, 2020
Customized wordpress install script with WP CLI
# Install Wordpress with Square Candy default using WP CLI
read -p 'Site URL ( ' url
read -p 'Site Title: ' title
read -p 'WP Admin username: ' admin_user
read -sp 'WP Admin password: ' admin_password
read -p '
WP Admin email: ' admin_email
read -p 'Database name: ' dbname
read -p 'Database user: ' dbuser
MikeNGarrett / wp-config.php
Last active Apr 16, 2021
All those damned wp-config constants you can never remember.
View wp-config.php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
nickcernis /
Last active Nov 27, 2020
MailChimp Popup Script that works with WordPress sites

MailChimp's default popup scripts can break on WordPress sites that use jQuery/jQuery UI unless you include their embed code as the final elements before the closing body tag.

Including them in this way isn't always possible or easy with WordPress.

The code below is an alternative implementation of the loader that forces MailChimp's popup scripts to appear below all other scripts upon page load.

To use it, modify the baseUrl, uuid, and lid attributes with the ones from the original popup script that MailChimp supplies.

View gist:122907e95956602e5c09
// slack2html
// by @levelsio