Skip to content

Instantly share code, notes, and snippets.

RyanNutt / jquery.showif.js
Created Dec 18, 2020
jQuery showIf / hideIf plugin
View jquery.showif.js
(function ($) {
$.fn.showIf = function (check) {
if (check) {
else {
RyanNutt /
Created Sep 20, 2020
Python unittest starter stub
import unittest
class TestClass(unittest.TestCase):
def test(self):
exp = 4
actual = 4
self.assertEqual(exp, actual, 'Some Message')
RyanNutt / disable-scaled-images.php
Created May 26, 2020
WordPress plugin to turn off auto creation of scaled images
View disable-scaled-images.php
* Plugin Name: Disable Scaled Images
* Plugin URI:
* Description: One liner to turn off automatic scaled image creation for large images
* Version: 0.1.0
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Ryan Nutt
* Author URI:
RyanNutt /
Last active Mar 2, 2020
Script to download media submissions from Canvas assignment
import json
import urllib.request
import sys
with open('submissions.json', 'r') as read_file:
data = json.load(read_file)
for sub in data:
filename = sub['user']['name'] + '.mpg4'
RyanNutt /
Created Feb 28, 2020
Update docker clock

Update Docker Clock

I switched to Docker from Virtual Box as a local web development environment a few months ago and find it much easier to work with. Except for one issue.

What I've found is that if a Docker container is running when my computer goes to sleep the clock stops and the container falls behind by however long my computer was asleep. Since the container is supposed to be in sync with my computer there didn't seem to be an easy way to update the container's clock. Lots of work arounds, but nothing quick and easy. And I couldn't find anything that worked without stopping the container first.

Stack Overflow to the rescue. I found this one liner that does exactly what I needed.

docker run --rm --privileged alpine hwclock -s
View .htaccess
RewriteEngine on
RewriteRule ^(.*)$ [R=301,L]
RyanNutt / moveToTop.js
Created Jan 29, 2020
jQuery plugin to move elements to top or bottom of parent
View moveToTop.js
* Move an element to the top of the stack by appending it to the end
* of its parent.
* The element, and its siblings, should be positioned in parent so that
* they're stacked on top of each other.
(function ($) {
$.fn.moveToBottom = function () {
return this.parent().prepend(this);
RyanNutt / PostTransient.php
Last active Jan 26, 2020
Class for WordPress to store transient data with a post::
View PostTransient.php
// This software is copyright 2020 Ryan Nutt -
// This software is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
RyanNutt / plugin.php
Created Jan 10, 2020
WordPress plugin starter with heading
View plugin.php
* Plugin Name: Plugin Name
* Plugin URI: https://...
* Description: Description
* Version: 0.1.0
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Name
* Author URI: https://...
View Gruntfile.js
'use strict';
module.exports = function (grunt) {
opts: {
/* Filename of the compiled JavaScript file */
jsName: 'project',
/* Filename of the compiled CSS file */
cssName: 'style',
companyName: 'Company Name',