Skip to content

Instantly share code, notes, and snippets.

View stephenscaff's full-sized avatar

Stephen Scaff stephenscaff

View GitHub Profile
@stephenscaff
stephenscaff / 000-default.conf
Last active May 18, 2018 18:32
Generate CSR, then set Apache config for ssl port at (on DO anyway) etc/apache2/sites-available/000-default.conf. Enable SSL on Virtual Host. Restart apache
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
@stephenscaff
stephenscaff / util-render.js
Created March 23, 2018 21:53
Render Utility, react-like
/**
* React-like Render Utility
*/
var render = function (template, node) {
if (!node) return;
node.innerHTML = (typeof template === 'function' ? template() : template);
var event = new CustomEvent('elementRenders', {
bubbles: true
});
node.dispatchEvent(event);
@stephenscaff
stephenscaff / do-wp-admin-updating.sh
Last active March 9, 2018 14:24
Enable updating from wp admin on Digital Ocean servers
# SSH In, then change permissions
sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www
# Restart apache
service apache2 restart
@stephenscaff
stephenscaff / copy-ssh-keys.sh
Created February 28, 2018 18:47
Copy SSH keys
pbcopy < ~/.ssh/id_rsa.pub
# or cat ~/.ssh/id_rsa.pub | pbcopy
[
{
"id": 86,
"date": "2018-01-15T03:31:08",
"date_gmt": "2018-01-15T03:31:08",
"guid": {
"rendered": "http://127.0.0.1/nokotoko/?post_type=product&#038;p=86"
},
"modified": "2018-01-15T15:55:33",
"modified_gmt": "2018-01-15T15:55:33",
@stephenscaff
stephenscaff / wp-menu-bug-fix.php
Created January 11, 2018 01:18
reopen wp collapsed menu
add_action('admin_init', 'change_user_settings');
function change_user_settings() {
set_user_setting('mfold', '');
}

Fields attributes cheatsheet

This is a overview of all default attributes associated with the different ACF(pro) fields. This Cheatsheet is quite handy when creating ACF fields with the StoutLogic Acf Builder.

Last update: 27/09/2017 ACF version: 5.6.2

Text field

$attributes = [
    'default_value' => '',
<?php
/**
* Simple Sitemap XML Class generator
* @author stephen scaff
*/
class SitemapXML{
// Add filters and actions in the construct
function __construct() {
// Build on save post
@stephenscaff
stephenscaff / _gmaps.js
Created August 25, 2017 17:41
Google Maps module.
/**
* Google Maps to VCards
* Parses location from markup into a google map
*/
if ($("#js-map").length) {
var CityMap = (function() {
var s;
@stephenscaff
stephenscaff / media query hacks.scss
Created July 18, 2017 21:21
Various Media Query-based hacks, mostly for IE, Edge.
// IE10
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){}
// IE9 + IE10
@media screen and (min-width:0\0){}
// IE10 + IE11
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {}
// Edge