Skip to content

Instantly share code, notes, and snippets.

View will-ashworth's full-sized avatar

Will Ashworth will-ashworth

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:atom="http://www.w3.org/2005/Atom" elementFormDefault="qualified">
<xs:import namespace="http://www.w3.org/2005/Atom" schemaLocation="atom.xsd"/>
<xs:element name="rss">
<xs:complexType>
<xs:sequence>
<xs:element ref="channel"/>
</xs:sequence>
<xs:attribute name="version" use="required" type="xs:decimal"/>
</xs:complexType>
@will-ashworth
will-ashworth / html5video.sh
Created October 17, 2019 18:39 — forked from liamcurry/html5video.sh
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
# Output file for HTML5 video
# requirements: ffmpeg .6+
# usage: ./html5video.sh infile.mp4 640x360
target_directory='converted'
file=`basename $1`
filename=${file%.*}
filepath=`dirname $1`
@will-ashworth
will-ashworth / example.po
Created August 30, 2019 16:43 — forked from bosskovic/example.po
A simple example of a PO file
msgid ""
msgstr ""
"Project-Id-Version: Lingohub 1.0.1\n"
"Report-Msgid-Bugs-To: support@lingohub.com \n"
"Last-Translator: Marko Bošković <marko@lingohub.com>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
// Select all links with hashes
$('a[href*="#"]') // Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, "") ==
this.pathname.replace(/^\//, "") &&
location.hostname == this.hostname
@will-ashworth
will-ashworth / query.sql
Created May 3, 2019 18:31
Manually clean up old Redirection plugin logs. In this example, we delete everything except the most recent month of entries.
DELETE FROM `wp_redirection_logs` WHERE `created` < NOW() - INTERVAL 30 DAY
DELETE FROM `wp_redirection_404` WHERE `created` < NOW() - INTERVAL 30 DAY
@will-ashworth
will-ashworth / functions.php
Created May 2, 2019 04:43
Sometimes it's necessary to adjust final output. Here's how.
<?php
function callback($buffer) {
// modify buffer here, and then return the updated code
return $buffer;
}
function buffer_start() { ob_start("callback"); }
function buffer_end() { ob_end_flush(); }
@will-ashworth
will-ashworth / nginx-rewrites-yoast-wordpress-seo
Created May 1, 2019 07:02 — forked from SimpleHomelab/nginx-rewrites-yoast-wordpress-seo
Nginx rewrites for Yoast's WordPress SEO plugin. These rewrites go into the Nginx host file between the server blocks.
# This rewrite redirects sitemap.xml to sitemap_index.xml, which is what Yoast's WordPress SEO plugin generates.
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
# This rewrite ensures that the styles are available for styling the generated sitemap.
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
# These rewrites rule are generated by Yoast's plugin for Nginx webserver
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
DB="your_database_name"
USER="your_db_user"
PASS="your_db_pass"
HOST="database_hostname"
(
echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_general_ci;'
mysql -p $PASS -u $USER -h $HOST "$DB" -e "SHOW TABLES" --batch --skip-column-names \
| xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;'
) \
| mysql -p $PASS -u $USER -h $HOST "$DB"
For
* ES5
* ES6
* CoffeeScript
@will-ashworth
will-ashworth / movegfjstofooter.php
Created January 14, 2019 06:35 — forked from eriteric/movegfjstofooter.php
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );