Skip to content

Instantly share code, notes, and snippets.

View uxjw's full-sized avatar

James Wilcox uxjw

  • Primal Communications Ltd.
  • BC, Canada
View GitHub Profile
@uxjw
uxjw / hide_wp_update_notifications.php
Last active February 24, 2019 00:42
When regularly checking and updating plugins, we don't need persistent update nags bugging clients. Just drop this file in /wp-content/mu-plugins/
<?php
/*
* Hide Wordpress, Plugin, & Theme Update Notifications
*
* When regularly checking for and applying updates, we don't
* need persistent update nags bugging clients.
*
* This plugin hides the update nags with CSS, but you can still access
* the updates page list under Dashboard.
*/
@uxjw
uxjw / chime.sh
Last active February 24, 2019 00:46
Hourly announcement with quiet hours
#!/bin/bash
# Announce the current hour
#
# Use cron to schedule this on the hour:
# 0 * * * * /path/to/script/chime.sh
#
# Change the voice used in System Preferences
# under Accessibility > Speech
# Wake up the text-to-speech engine, which sometimes
@uxjw
uxjw / .gitignore
Created January 13, 2017 00:47
Wordpress git ignores
# OPERATING SYSTEMS
.DS_Store
.AppleDouble
.LSOverride
._*
*.lock
.Spotlight-V100
.Trashes
.svn
Thumbs.db
@uxjw
uxjw / ios_vh_fix.css
Created December 15, 2016 07:57
iOS doesn't swap vh and vw like you would expect in landscape view, so we have to set these manually
/* fix iOS bug not displaying 100vh correctly */
/* iPad Pro */
@media only screen and (min-device-width : 1024px) and (max-device-width : 1366px) and (orientation : landscape) {
.fullheight {
height: 1024px;
}
}
@media only screen and (min-device-width : 1024px) and (max-device-width : 1366px) and (orientation : portrait) {
.fullheight {
@uxjw
uxjw / .htaccess
Last active January 30, 2016 06:38
Wordpress .htaccess Protections and Caching
Options +FollowSymlinks -Indexes
RewriteEngine On
# Disable the Server Signature
ServerSignature Off
# BEGIN WordPress
# Except for requests for /index.php and for the most-frequently-requested
# filetypes that WP cannot generate, rewrite all URL requests which do not
# resolve to an existing file or directory to the WordPress script filepath
/*
Fluid App Userscript
FastMail beta web interface
URL pattern: *fastmail.fm/mail/*
Based on https://github.com/melomac/Fluid
*/
@uxjw
uxjw / tinymce_functions.php
Created May 7, 2015 00:05
Prevent TinyMCE from stripping schema.org Metadata
<?php
// Prevent TinyMCE from stripping out schema.org metadata
function schema_TinyMCE_init($in)
{
/**
* Edit extended_valid_elements as needed. For syntax, see
* http://www.tinymce.com/wiki.php/Configuration:valid_elements
*
* NOTE: Adding an element to extended_valid_elements will cause TinyMCE to ignore
@uxjw
uxjw / select_country.html
Created May 7, 2015 00:03
County Code Select
<!-- Generated from http://www.iso.org/iso/country_codes.htm on 2013/01/22 -->
<select name="country">
<option value="AF">AFGHANISTAN</option>
<option value="AX">&Aring;LAND ISLANDS</option>
<option value="AL">ALBANIA</option>
<option value="DZ">ALGERIA</option>
<option value="AS">AMERICAN SAMOA</option>
<option value="AD">ANDORRA</option>
<option value="AO">ANGOLA</option>
<option value="AI">ANGUILLA</option>
@uxjw
uxjw / youtube-embed.txt
Created May 7, 2015 00:01
Youtube iFrame, Minimal branding
https://www.youtube.com/embed/VIDEOID?rel=0&controls=0&modestbranding=1&showinfo=0&hd=1&autoplay=1
@uxjw
uxjw / wordTrim.php
Last active August 29, 2015 14:20
Trim a string to a set length of words
<?php
// Shorten a string to a specific word count
function wordTrim($str,$maxwords=25, $more = '...'){
$words = explode(' ',trim($str));
if(count($words) > $maxwords)
{
$newStr = array();
for($i=0;$i<$maxwords;$i++)
$newStr[] = $words[$i];