Skip to content

Instantly share code, notes, and snippets.

View plasticmind's full-sized avatar

Jesse Gardner plasticmind

View GitHub Profile
@plasticmind
plasticmind / navigate-all
Created February 13, 2014 18:53
Next/Previous: Include multiple post types
/* = Adjust next/previous links to include multiple post types */
/*
* Replacement for get_adjacent_post()
*
* This supports only the custom post types you identify and does not
* look at categories anymore. This allows you to go from one custom post type
* to another which was not possible with the default get_adjacent_post().
* Orig: wp-includes/link-template.php
*
@plasticmind
plasticmind / gist:9260407
Created February 27, 2014 21:53
UIWebView links open in Safari if the URL doesn't match a certain pattern
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if ( navigationType == UIWebViewNavigationTypeLinkClicked ) {
NSString *urlString = request.URL.absoluteString;
// Set the pattern to search the request URL for
NSRange range = [urlString rangeOfString:@"mobile.example.com"];
if (range.location != NSNotFound) {
NSLog(@"%s", "This link matches the pattern and will be loaded in-app within the UIWebView.");
return YES;
} else {
NSLog(@"%s", "This link does NOT match the pattern and will be loaded in Safari.");
<?php
// change to repo directory, run a git pull and echo the output
echo shell_exec("cd /your/repo/path/here && git pull");
die("done " . mktime());
// == Create a simple hash based on a file checksum
function sr_version_hash($file) {
if(!$file) return false;
$full_path = get_template_directory() . $file;
return hash_file('CRC32',$full_path);
}
@plasticmind
plasticmind / gist:14e04ebfa734b13e720f
Created November 19, 2014 17:07
Adjusted Bounce Rate for Google Analytics
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX']);
_gaq.push(['_trackPageview']);
setTimeout("_gaq.push(['_trackEvent', '15_seconds', 'read'])",15000);
setTimeout("_gaq.push(['_trackEvent', '30_seconds', 'read'])",30000);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
{
"color_scheme": "Packages/User/SublimeLinter/Sunburst (SL).tmTheme",
"font_face": "Operator Mono",
"font_options":
[
"gray_antialias"
],
"font_size": 21,
"ignored_packages":
[
@plasticmind
plasticmind / gist:8bbfcfc3e7b07de7897b8e88c6d567ef
Created March 20, 2018 13:32
DigiPublish Panel: The Current State of Digital Publishing and Its Challenges in Business
# Panel
Elizabeth Brady, Director Audience Engagement, People, @sheerling
Brian Kroski, Former Chief Digital Officer, AMI, @briankroski
Garrett Bewkes, Publisher, National Review, @egbewkes
Linda Li, Director, Global Strategy and Dev, NYT @multilinda
## Biggest Challenges for the Year
- Linda Li (NYT): NYT has 2.6 million digital subscribers — need to change the perception about how consumers feel about the company as a brand; convincing people to pay for news.
@plasticmind
plasticmind / gist:707e65d61cbe57baa49cc9c5a4748844
Created December 12, 2019 04:24
Cubes Visualization for Processing
import ddf.minim.*;
import ddf.minim.analysis.*;
Minim minim;
AudioPlayer song;
FFT fft;
// Group frequency bands into 3 zones
// Note: dropping the top 64% of the frequency
// bandwidth since we can't hear it
@plasticmind
plasticmind / functions.php
Last active July 14, 2022 09:41
Adding column count class to Gutenberg columns block
<?php
/**
* inject_class_column_count
*
* @param string $content The block content about to be appended.
* @param array $block The full block, including name and attributes
* @return $content;
*/
function inject_class_column_count( $content, $block ) {
if ( ! is_block_type( $block, "core/columns" ) ) {
@plasticmind
plasticmind / coronavirus-news-04-06-2020.md
Last active April 6, 2020 20:40
Coronavirus Updates: Monday, April 6, 2020

This post appeared is written by Daniel Hanson and appeared originally at: https://www.facebook.com/photo.php?fbid=10222159161191103&set=a.2392855263881&type=3

===

It’s the Monday between Palm Sunday and Easter, a moment for reflection on life and death. Here’s a 10 minute quick summary of some salient corona news.

The curve is bending and flattening. Social distancing is working, and as a consequence, we’ve gone from doubling the number of deaths in the US every three days to doubling them every four. That’s great news, and it should reduce the total number of deaths from this disease meaningfully. Still, more than 10,000 Americans have died from this disease as of this morning.

Hospitalization is a leading indicator; people tend to be hospitalized before they die from the disease. Typically, death from coronavirus comes about 16 days after being admitted to the hospital, and in this respect, it seems that New York has turned the corner. NY had fewer deaths yesterday than it has since mid-March, but that