Skip to content

Instantly share code, notes, and snippets.

View willthemoor's full-sized avatar

Will Moore willthemoor

  • OHSU
  • Portland, OR
View GitHub Profile
@willthemoor
willthemoor / clean-html.md
Created April 28, 2019 19:46
Clean up HTML with comments and blank lines

Clean up HTML with twig template suggestion comments, etc.

In Atom anyway, with Regex enabled, find/replace:

1. Get rid of comments with:

Find: (?=<!--)([\s\S]*?)-->
Replace: ""

2. Clean up blank lines with:

a
abbr
acronym
address
applet
applet
area
article
aside
audio
@willthemoor
willthemoor / get-todoist.js
Created August 5, 2016 04:37
Todoist list HTML to CSV via Console
/**
*
* Dump a CSV of all Todoist task to your browser console.
*
* NOTE: Sorry, I was lazy. Requires jQuerify or similar running in your browser
* Alternatively, copy the HTML from Todoist and drop it into the HTML
* field within codepen.io, jsfiddle.net or similar
*
* 1. Run it
* 2. Copy and Paste into Excel
@willthemoor
willthemoor / wp-include-image-sizes-in-admin.php
Last active August 31, 2015 23:15
WordPress: Add URLs for all generated image sizes to Media Library listing
<?php
/*
* Include the URLs for all image sizes in the WordPress Media Library.
* Not normally needed but if you're trying to gather a bunch of URLs it helps.
* Hide the column in Screen Options when not needed.
*
* Drop this in your site plugin or function.php
*/
// Adds a "Sizes" column
@willthemoor
willthemoor / jquery.retinafy-inline-background-images.js
Created August 28, 2015 16:33
Convert inline css background images to their @2x counterparts
/*
* retinafyInlineBackgroundImages
* Convert inline css background images to their @2x counterparts
* http://ecotrust.org
* https://gist.github.com/willthemoor/f25e945f716399bd6eec
*
* Made by Will Moore @ Ecotrust
* Under MIT License
*
* NOTE: For background images in your CSS, just use media queries.
@willthemoor
willthemoor / lorem.jade
Last active June 30, 2018 14:03 — forked from geedmo/lorem.jade
Lorem Ipsum generator mixin for Jade (single paragraph)
//- ----------------------------------
//- Simplified version.
//-
//- Usage:
//- include lorem
//- p: +lipsum(42)
//- ----------------------------------
mixin capitalize(string)
@willthemoor
willthemoor / oregon-school-districts
Created May 27, 2015 17:06
Oregon School Districts (Simplified)
{"type":"FeatureCollection",
"features":[
{"type":"Feature","properties":{"NAME":"Adel SD","AREA":15276139258.56,"PERIMETER":538015.702,"DIST_":21,"CNTY":"Lake","INST_ID":2063,"DIST_ID":"21.0000"},"geometry":{"type":"Polygon","coordinates":[[[-120.046,42.2214],[-119.6856,42.2214],[-119.3636,42.2201],[-119.3594,42.137],[-119.3602,41.9944],[-119.6147,41.9958],[-119.8729,41.9976],[-120.0478,41.9951],[-120.046,42.2214]]]}},
{"type":"Feature","properties":{"NAME":"Adrian SD","AREA":8170049047.868,"PERIMETER":531225.781,"DIST_":61,"CNTY":"Malheur","INST_ID":2113,"DIST_ID":"61.0000"},"geometry":{"type":"Polygon","coordinates":[[[-117.0349,43.8087],[-117.0264,43.7641],[-117.0267,43.4208],[-117.1423,43.4213],[-117.1419,43.5188],[-117.3478,43.5191],[-117.3548,43.5302],[-117.3468,43.5637],[-117.3379,43.5831],[-117.2935,43.6133],[-117.2707,43.6136],[-117.2381,43.6322],[-117.2556,43.6749],[-117.2083,43.6792],[-117.2078,43.7033],[-117.1921,43.7216],[-117.2822,43.7225],[-117.2821,43.8095],[-117.0349,43.8087]]]}},
{"t
@willthemoor
willthemoor / active-WP-Plugins
Created April 16, 2014 18:35
Get a list of your WP Plugins
// Run this in your browser's JS console while on the plugins page of WP Admin
// Helpful when sharing active list with a plugin developer to debug potential conflicts
// This will print out all plugins and indicate which are inactive.
// If you want a list of active only, click on 'active' first in the WP Admin
jQuery('.plugin-title').each(function () {
var $t = jQuery(this),
name = $t.find('strong').text(),
// Add role class to body
function ns_add_role_to_body($classes) {
global $current_user;
$user_role = array_shift($current_user->roles);
// body classes are built differently on the front and back end.
// https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-admin/admin-header.php#L164
if ( ! is_admin() ) {
$classes[] = 'role-'. $user_role;
}