Skip to content

Instantly share code, notes, and snippets.

View jcamp's full-sized avatar

Jonathan jcamp

View GitHub Profile
@jcamp
jcamp / next_last_payment_dates_members_list.php
Created May 27, 2021 09:52 — forked from kimcoleman/next_last_payment_dates_members_list.php
Adds last payment date and next payment date to the members list and export CSV in Paid Memberships Pro (PMPro).
<?php
/**
* Adds last payment date and next payment date to the members list and export CSV.
* Note that "last payment" value will get the last order in "success", "cancelled", or "" status. (Oddly enough, cancelled here means that the membership was cancelled, not the order.)
*
* The "next payment" value is an estimate based on the billing cycle of the subscription and the last order date. It may be off from the actual recurring date set at the gateway, especially if the subscription was updated at the gateway.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.

Algorithmic layouts

You are looking at the most important, and most abundant thing on the web. You can't see it, unfortunately, because it's very small… aaaaand it's invisible — so having a magnifying glass doesn't really help here. But still.

I'm talking, of course, about U+0020; not to be confused with the band U2, who are just as ubiquitous, but far less useful.

This unicode point, representing the humble space character, is between every word, in every run of text, on every page of the web. And it has a very special characteristic: it's not sticky like glue. If two words are neighbors but there's not enough room for both of them, the space will free the second word to wrap around and start a new line.

Before getting into flexible containers, viewport meta tags, and @media breakpoints this humble character is what makes the web fundamentally 'responsive'. That is: able to change the layout of its content to suit different devices, contexts, and settings. Browser text does this automa

@jcamp
jcamp / write_log.php
Created August 13, 2018 16:45
Very simple logging to a file by calling 'write_log' in our php code (wordpress edition)
<?php
// Taken pretty much from https://www.elegantthemes.com/blog/tips-tricks/using-the-wordpress-debug-log
// error_log info on php site - http://php.net/manual/en/function.error-log.php
// Just stick this function in your functions.php if you like :)
if ( ! function_exists('write_log')) {
function write_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
// error_log - Sends an error message to the web server's error log or to a file.
error_log( print_r( $log, true ) );
@jcamp
jcamp / functions_enqueue_child_theme.php
Created August 13, 2018 16:40
Wordpress enqueue styles with child styles (takes into account Bootstrap in this case load bootstrap and then override)
<?php
// Basically we need to make sure we load ALL our stylesheets for our child theme AFTER bootstrap
// that way we can override bootstrap without using crappy !important overrides, etc.
// This sample uses the transportex theme but just replace that for your own theme.
function my_theme_enqueue_styles() {
$parent_style = 'transportex-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
@jcamp
jcamp / video-editors-opensource.md
Last active July 11, 2024 20:51
OpenSource Video Editors
@jcamp
jcamp / essential-wordpress-plugins.md
Last active November 25, 2021 15:34
Essential Wordpress Plugins
@jcamp
jcamp / divi-child
Last active May 6, 2017 17:50
DIVI Wordpress Child theme - style.css and functions.php
The correct way to add a child theme to DIVI and other themes.
If you don't understand this you are probably in the wrong place.
More info: https://codex.wordpress.org/Child_Themes
style.css
functions.php
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active July 25, 2024 18:56
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@ericandrewlewis
ericandrewlewis / gist:95239573dc97c0e86714
Last active December 12, 2023 09:52
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.