Skip to content

Instantly share code, notes, and snippets.

Joe Maller joemaller

View GitHub Profile
joemaller / svg-animate.js
Last active Apr 15, 2019
Vanilla JS SVG line animation helper, works in IE
View svg-animate.js
* Initialize animation on an SVG path or set of paths, this returns a controller
* object
* var lines = animate({
* parent: "#someElement",
* selector: ".theActualLines",
* duration: 2500
* })
joemaller / banner.js
Created Apr 1, 2019
dumb little reporting helper
View banner.js
const banner = (str = "", len = 100, pad = "-") => {
if (str.length > len) return str;
const out = new Array(len);
out.splice(Math.floor((len - str.length - 1) / 2), 0, ` ${str} `);
return `\n${out.join(pad).substring(0, len)}`;
joemaller / .htaccess
Created Mar 14, 2019
A very simple htaccess file for redirecting traffic from http to https (insecure to secure)
View .htaccess
RewriteEngine On
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
ErrorDocument 404 /404.html
ErrorDocument 401 "Unauthorized Access"
joemaller / redirect.html
Last active Mar 8, 2019
A basic redirect page with fallbacks: Meta refresh tag, JavaScript window.location and a bare link
View redirect.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="0;url=SITE_ADDRESS" />
<title>SITE_NAME Redirect</title>
joemaller /
Created Nov 30, 2018
An example of what's possible to do with Markdown.

Markdown Reference Sample

An example of what's possible to do with Markdown.

Basic formatting

Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.

Paragraphs must be separated by a blank line. Basic formatting of italics and bold is supported. This can be nested like so.

joemaller / functions.php
Created Oct 1, 2018
flush WordPress rewrite rules on every page load
View functions.php
* Expensive, but helpful if permalink structures are changing freuqently
* Don't do this on a production site.
add_action('init', 'flush_rewrite_rules');
joemaller /
Last active Sep 26, 2018
A quick image compression gulp workflow using

Gulp pngquant Workflow

A quick image compression gulp workflow using pngquant.


  1. Run npm install
  2. Creatae a ./src dir and put some images in it
  3. npm run build to compress, npm run start to compress and watch ./src for new files
joemaller / Verizon FiOS - DNS
Created May 9, 2018
Nameservers for Verizon FiOS - North East US specific
View Verizon FiOS - DNS

Boston, MA:

  • -

New York, NY:

  • -

Newark, NJ: -

Philadelphia, PA:

joemaller / .htaccess
Last active Mar 29, 2018
Redirect HTTP to HTTPS from .htaccess
View .htaccess
# .htaccess redirects can vary depending on server caching, reverse proxies and CDNs
# Try these RewriteConditions in order, starting from the top and stepping down
# until one works. Only enable one RewriteConds at a time.
RewriteEngine On
# 1. Try this first
RewriteCond %{HTTPS} off
# 2. Docs suggest on|off should work, but try this anyway
joemaller /
Created Jan 23, 2018
Luxon Timestamps

Finding this took me longer than it should have, probably because I was impatiently looking for "timeststamp" instead of "milliseconds of the Unix epoch". For future searchers, Luxon uses the methods DateTime.fromMillis and DateTime.valueOf.

// Create a Luxon DateTime from a JS Unix timestamp
const ts = new Date().getTime();     // 1516717417146
const dt = DateTime.fromMillis(ts);  // { ts: 2018-01-23T09:23:37.146-05:00 ...
console.log(dt.valueOf());           // 1516717417146
You can’t perform that action at this time.