Skip to content

Instantly share code, notes, and snippets.

View modemlooper's full-sized avatar
🏠
Working from home

modemlooper modemlooper

🏠
Working from home
View GitHub Profile
@modemlooper
modemlooper / sign.php
Created October 2, 2019 17:30 — forked from wouterdewinter/sign.php
Tutorial: Securing private content on AWS Cloudfront
<?php
/**
* Sign a private asset url on cloudfront
*
* @param $resource full url of the resources
* @param $timeout timeout in seconds
* @return string signed url
* @throws Exception
*/
@modemlooper
modemlooper / wordpress-upload-base64.php
Created January 9, 2019 19:14
Upload a base64 string as image to the WordPress media library
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
$img = str_replace( 'data:image/jpeg;base64,', '', $base64_img );
@modemlooper
modemlooper / letsencrypt.md
Created March 30, 2018 02:32
Installing Let's Encrypt with Cerbot on DigitalOcean & ServerPilot

Let's Encrypt

SSH as root into the server

ssh root@SERVER_IP_ADDRESS

Install Certbot

wget https://dl.eff.org/certbot-auto
@modemlooper
modemlooper / update-forum-groupmeta.php
Created April 19, 2016 19:20 — forked from jazzsequence/update-forum-groupmeta.php
Updates the group meta for forum id based on updated forum ids.
<?php
/*
Plugin Name: WDS CLP Update Forum Group Meta Script
Description: Updates the group meta for forum id based on updated forum ids.
Author: WebDevStudios
Author URI: http://webdevstudios.com
Version: 1.0
License: GPL2
*/
@modemlooper
modemlooper / searchwp_results_substitute_post_for_attachment.php
Created September 28, 2015 16:14 — forked from rogerlos/searchwp_results_substitute_post_for_attachment.php
Wordpress SearchWP: Substitute Post for Attachment in Search Results
<?php
/**
* This function will see if a PDF or other "attachment" post-type returned by SearchWP
* is present in a custom field in a regular post, and will return that post instead. Note
* this will only process documents which are referenced via the "attachment" post type.
*
* For example, you may have a product specification PDF and would like it in the search
* results, but would rather people got to it by visiting the product page itself.
*