Skip to content

Instantly share code, notes, and snippets.

View robertannett's full-sized avatar

Robert Annett robertannett

View GitHub Profile
@robertannett
robertannett / index.html
Created November 13, 2017 21:32
Zurb Video Modal - Autoplay on open & Pause on Close
<div class="body text-center">
<div class="reveal" id="exampleModal1" data-reveal>
<video width="100%" controls>
<source src="http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<button class="close-button" data-close aria-label="Close modal" type="button">
@robertannett
robertannett / svg-to-png-fallback.js
Last active August 30, 2019 09:31
Use svg image if supported - fallback to png if not (Using Modernizr check for svg)
// Swap SVG to PNG of the same name on unsupported browsers
// Requires Modernizr with SVG: https://modernizr.com/download?svg-svgasimg-setclasses&q=svg
if (!Modernizr.svg) {
var imgs = document.getElementsByTagName('img');
var svgExtension = /.*\.svg$/
var l = imgs.length;
for(var i = 0; i < l; i++) {
if(imgs[i].src.match(svgExtension)) {
imgs[i].src = imgs[i].src.slice(0, -3) + 'png';
// console.log(imgs[i].src);
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ApplicationVersion extends \Base
{
public static function get()
{
$commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
/**
* https://stackoverflow.com/questions/16334310/display-the-current-git-version-in-php
*/
class ApplicationVersion
{
const MAJOR = 1;
const MINOR = 2;
const PATCH = 3;

Keybase proof

I hereby claim:

  • I am robertannett on github.
  • I am robertannett (https://keybase.io/robertannett) on keybase.
  • I have a public key ASAunx_6OqHbj5uibOTfDe2c7KGhgEnx_6YWD03n2b4x6wo

To claim this, I am signing this object:

@robertannett
robertannett / templatefinder.php
Created May 24, 2021 11:22
WP Template Finder
// Place me in the header
<?php if (defined('WP_DEBUG') && true === WP_DEBUG) { ?>
<div style="background: lightslategray; color: white; position: fixed; bottom: 1rem; right: 1rem; z-index: 9999; padding: 1.5rem 2rem 0.5rem;">
<p style="color: white; font-weight: bold;">DEBUG INFO</p>
Page ID: <?= $post->ID; ?><br />
Post Type: <?= $post->post_type; ?><br />
Template: <?= basename(get_page_template()); ?></p>
<hr />
<p><a href="/wp-admin/post.php?post=<?= $post->ID; ?>&action=edit" style="text-decoration:underline; color: white;"><b>Edit Page</b></a></p>
</div>
@robertannett
robertannett / gutenberg-blocks.php
Last active June 3, 2021 16:48
Wordpress - Gutenberg Core Block List
$default_blocks = array(
'core/paragraph',
'core/image',
'core/heading',
'core/gallery',
'core/list',
'core/quote',
'core/audio',
'core/cover',
'core/file',
@robertannett
robertannett / whitelist-blocks.php
Created May 31, 2021 14:52
Wordpress - Disable Gutenberg blocks / Whitelist Blocks
/*
** Reference: https://rudrastyh.com/gutenberg/remove-default-blocks.html
*/
add_filter( 'allowed_block_types', 'custom_allowed_block_types', 10, 2 );
function custom_allowed_block_types( $allowed_blocks, $post ) {
$allowed_blocks = array(
'core/paragraph',
@robertannett
robertannett / remove-thumbs.txt
Last active July 13, 2021 10:39
Delete Wordpress Generated Thumbs
// cd to /uploads folder and run
find . -name "*-*x*.*" -type f -delete
@robertannett
robertannett / gist:60ad8e7bc3bfab1e1e253c19333a29cf
Created August 11, 2021 10:42
SQL - Update Wordpress Password
UPDATE wp_users
SET user_pass= MD5('password')
WHERE ID = 9999;