sudo apt update && sudo apt upgrade -y
sudo apt autoremove && sudo apt clean
pbcopy < ~/.ssh/id_rsa.pub
<?php | |
/* | |
Plugin Name: Restrict Content Pro - Custom User Fields | |
Description: Illustrates how to add custom user fields to the Restrict Content Pro registration form that can also be edited by the site admins | |
Version: 1.0 | |
Author: Pippin Williamson | |
Author URI: http://pippinsplugins.com | |
Contributors: mordauk | |
*/ |
// Inspired by https://towardsdatascience.com/quickly-extract-all-links-from-a-web-page-using-javascript-and-the-browser-console-49bb6f48127b | |
var atags = document.querySelectorAll("a"); | |
let links = []; | |
let hashes = {}; | |
for await (atag of atags){ | |
var anchor = atag.textContent.replace(/\s+/g, ' ').trim(); | |
var link = atag.href.replace(/\/$/, ""); // remove trailing slash | |
var rel = atag.rel; | |
var hash = md5(link) |
<?php | |
/** | |
* Detect if the current user has concurrent sessions | |
* | |
* @return bool | |
*/ | |
function pcl_user_has_concurrent_sessions() { | |
return ( is_user_logged_in() && count( wp_get_all_sessions() ) > 1 ); | |
} |
<?php | |
/* | |
Usage: | |
cache_fragment_output( 'unique-key', 3600, function () { | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
}); | |
*/ | |
function cache_fragment_output( $key, $ttl, $function ) { |
/////////////////////////////////////////////// | |
////// GRAVITY FORMS RESET STYLES ////// | |
/////////////////////////////////////////////// | |
// These styles are made in mind to be used with SCSS or LESS | |
// If you use these styles, you must go to the Gravity Forms settings in the WordPress back end and set Output CSS to No. | |
////----- Core Containers | |
.gform_heading, | |
.gform_body, |
const puppeteer = require('puppeteer'); | |
const imagemin = require('imagemin'); | |
const imageminPngquant = require('imagemin-pngquant'); | |
// Get the URL and the slug segment from it | |
const url = process.argv[2]; | |
const segments = url.split('/'); | |
const slug = segments[segments.length-2]; | |
(async () => { |
<?php | |
/* | |
Plugin Name: Norcross Debug Functions | |
Plugin URI: https://gist.github.com/norcross/7864205/ | |
Description: A set of functions I use on all sites while building | |
Author: Andrew Norcross | |
Version: 0.0.1 | |
Requires at least: 3.0 | |
Author URI: http://andrewnorcross.com | |
*/ |
<?php | |
/* | |
Usage: | |
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
if ( !$frag->output() ) { // NOTE, testing for a return of false | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
// IMPORTANT | |
$frag->store(); | |
// YOU CANNOT FORGET THIS. If you do, the site will break. |
#!/bin/bash | |
mkdir wordpress-site && cd wordpress-site | |
touch docker-compose.yml | |
cat > docker-compose.yml <<EOL | |
version: "2" | |
services: | |
my-wpdb: |