Skip to content

Instantly share code, notes, and snippets.

View splitinfinities's full-sized avatar

William M. Riley splitinfinities

View GitHub Profile
@splitinfinities
splitinfinities / example.js
Created September 22, 2021 18:41
Examples of Stencil's Stats
// With some bundler parser with Webpack or Rollup:
import json from "./stencil-stats.json"
// or with CSS Import Assertions:
// import json from "./stencil-stats.json" assert { type: "json" };
export const get_preload_tags = (components, format = "esmBrowser") => {
const entries = json.formats[format];
const set = components.map((element) => {
let files = [];
@splitinfinities
splitinfinities / caching-result-of-heavy-processing.php
Last active January 23, 2018 06:08
Caching heavy processing for 24 hours in WordPress
<?php
/**
* This code helps you cache a chunk of heavy processing code in WordPress.
*
* Examples:
* - WooCommerce has quite a lot of these in their plugins. I've used
* this general concept on WooCommerce sites many times, but when using
* it you must be strategic.
* - Membership plugins or anything behind authentication busts the caching layer,
* because the content needs to be pulled from the server.
@splitinfinities
splitinfinities / Add jQuery
Created January 3, 2017 15:58
Add jQuery (chrome bookmark)
javascript:var script = document.createElement("script"); script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"; script.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script);
@splitinfinities
splitinfinities / base.php
Created November 5, 2016 07:18
Simple WordPress Wrapper
<?php
use SPLIT\Wrapper;
?>
<head>
<?php wp_head(); ?>
</head>
<body>
<?php include Wrapper\template_path(); ?>
<?php wp_footer(); ?>
</body>
### Keybase proof
I hereby claim:
* I am bill-riley on github.
* I am bill_riley (https://keybase.io/bill_riley) on keybase.
* I have a public key whose fingerprint is 86D6 85C2 5BB9 248A A1CC C78E D9DE 36B3 8761 93A3
To claim this, I am signing this object:
@splitinfinities
splitinfinities / gist:c4feea3cbafcdd8838c0
Created August 5, 2014 14:52
on blur for every place ever
// Taken from line 456 of this: http://williamriley.me/js/vendor/metronome.js
var hidden = "hidden";
// Standards:
if (hidden in document)
document.addEventListener("visibilitychange", onchange);
else if ((hidden = "mozHidden") in document)
document.addEventListener("mozvisibilitychange", onchange);
else if ((hidden = "webkitHidden") in document)
document.addEventListener("webkitvisibilitychange", onchange);

Mash the Keyboard -- Header Parallax

Mash the Keyboard uses a subtle parallaxing tactic on the header -- in this pen I explain how to accomplish the layout, style and action of the parallaxing itself. to keep the content readable and interactive. you might not want to use this on mobile -- iOS devices don't register the scroll event kindly.

A Pen by William Riley on CodePen.

License.