Skip to content

Instantly share code, notes, and snippets.

Ryan Nutt RyanNutt

View GitHub Profile
View Jeroo.java
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
kellenmace / class-download-remote-image.php
Last active Feb 28, 2020
Download and Insert a Remote Image File into the WordPress Media Library
View class-download-remote-image.php
<?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
Shelob9 / serve-side-block.js
Last active Aug 4, 2020
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
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.Assignment.lti.id",
com_instructure_originality_report_id: "$com.instructure.OriginalityReport.id",
com_instructure_submission_id: "$com.instructure.Submission.id",
com_instructure_file_id: "$com.instructure.File.id",
course_offering_sourced_id: "$CourseOffering.sourcedId",
context_id: "$Context.id",
context_sourced_id: "$Context.sourcedId",
message_document_target: "$Message.documentTarget",
@M165437
M165437 / ScheduleList.php
Last active Feb 19, 2020
PHP Artisan command that lists all scheduled tasks: php artisan schedule:list (Credit: https://stackoverflow.com/a/35559970/2714126)
View ScheduleList.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
class ScheduleList extends Command
{
/**
@cfebs
cfebs / vboxhostonlyssh.md
Last active Aug 19, 2019
setup a vbox ubuntu server with host only adapter
View vboxhostonlyssh.md

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
petertwise / wp-cli-oneclick-install.sh
Last active May 18, 2020
Customized wordpress install script with WP CLI
View wp-cli-oneclick-install.sh
#!/bin/bash
# Install Wordpress with Square Candy default using WP CLI
read -p 'Site URL (example.com): ' 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
MikeNGarrett / wp-config.php
Last active Aug 1, 2020
All those damned wp-config constants you can never remember.
View wp-config.php
<?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
nickcernis / mailchimp-popup-for-wordpress.md
Last active Jun 30, 2020
MailChimp Popup Script that works with WordPress sites
View mailchimp-popup-for-wordpress.md

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.

<script>
View gist:122907e95956602e5c09
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
You can’t perform that action at this time.