Skip to content

Instantly share code, notes, and snippets.

View jazzsequence's full-sized avatar
🚀
Hacking, probably.

Chris Reynolds jazzsequence

🚀
Hacking, probably.
View GitHub Profile

Playground Comment Worker

This simple playground.yml creates a comment that opens a WordPress Playground and installs the plugin from the current repository. The current iteration only works with plugins that do not require a build step.

Playground test comment in action

CORS issues

Because GitHub doesn't send the right CORS headers for zip files to be able to install them in a Playground, you need a reverse proxy to bypass the CORS restrictions. The Worker below in worker.js can be used as a Cloudflare worker that

@kyletaylored
kyletaylored / multisite-lando-config.yml
Last active July 26, 2022 15:12
Lando WordPress Network Site / Multisite (WPMS)
# Using the pantheon recipe / wordpress_network framework, we add a config to the
# appserver_nginx service to use our own server and vhost files. Copy the files lando
# uses and on the wordpress_network.conf.tpl and added wp/ to the rewrite
# rules so lando knows where our WP files live within our Bedrock setup.
appserver_nginx:
type: nginx
ssl: true
config:
server: 'private/config/lando/nginx.conf.tpl'
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active March 12, 2024 22:46
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@scottopell
scottopell / fix_exfat_drive.md
Last active April 30, 2024 22:46
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@jazzsequence
jazzsequence / plugin-ideas.md
Last active December 12, 2017 18:56
Plugin Ideas

Plugin Ideas

Just some pie-in-the-sky ideas for plugins so I don't forget.

  • Minutes to Read Provides a Medium-like estimate about how long an article/post would take to read. Figure out how Medium does this (has to be related to word count, which we can get from WordPress) and build something that works similarly.
    This is how Medium does it.

  • Local Localization User-specific localization options. Instead of site-wide, global language settings, localization settings could/should be specific to the user -- for instance, a developer building a site for a non-English-speaking company or having many users, some of whom speak one language and others that speak a different language. Would load a different language file per user.

  • WP Raffles Rafflecopter clone using WordPress that's done better.

@joshlevinson
joshlevinson / To create a new site
Last active April 14, 2016 17:00
Creating a VVV site with no down time
vagrant ssh
cd /srv/www/
mkdir site-name && cd site-name && mkdir htdocs && cd htdocs
wp core download
wp core config --dbname=site-name --dbuser=root --dbpass=root
# Before you install the site, you'll need to create the DB. I just pull up phpMyAdmin and create it there.
wp core install --url=site-name.dev --title=Site --admin_user=admin --admin_pass=password --admin_email=admin@example.dev
# Create the files "vvv-hosts" and "vvv-nginx.conf"
@thagxt
thagxt / url-check.php
Created September 4, 2015 20:27
php function to check if URL is 404 or nah
<?php
// check if URL exists
function checkUrl($url) {
// Simple check
if (!$url) { return FALSE; }
// Create cURL resource using the URL string passed in
$curl_resource = curl_init($url);
// Set cURL option and execute the "query"
@ramiabraham
ramiabraham / parbs-scale.md
Last active March 13, 2018 16:32
The Parbs Scale

The Parbs Scale: a Unit of Measurement for the Modern World


A Practical Means of Measuring Human-scale Physical Objects

Author: Rami Abraham
August 30, 2015

Abstract

@nickdavis
nickdavis / gist:10525079
Created April 12, 2014 08:41
.htaccess 301 redirect local WordPress dev site images folder to live website images folder (to save fllling up local drive with 1000's of unnecessary images)
#301 Redirect Local Images to Live
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
@murdaugh
murdaugh / copy post to blog function
Created October 3, 2013 20:11
Copies a post (as well as its associated meta data) from one wordpress blog to another on the same network.
<?php
function copy_post_to_blog($post_id, $target_blog_id) {
$post = get_post($post_id, ARRAY_A); // get the original post
$meta = get_post_meta($post_id);
$post['ID'] = ''; // empty id field, to tell wordpress that this will be a new post
switch_to_blog($target_blog_id); // switch to target blog
$inserted_post_id = wp_insert_post($post); // insert the post
foreach($meta as $key=>$value) {
update_post_meta($inserted_post_id,$key,$value[0]);
}