Skip to content

Instantly share code, notes, and snippets.

View cogdog's full-sized avatar

Alan Levine cogdog

View GitHub Profile
@cogdog
cogdog / functions.php
Created September 14, 2018 14:06
SPLOT Writer functions
<?php
/* tru-writer theme functions
Lives and forks at http://github.com/cogdog/truwriter
Much of the magic happens here. Edit your own discretion, peril, unless you
find a coding error, and by all means please fork this to the github repo
thus you are deemed an honorary SPLOT knight.
We suggest putting your own extra groovy code in incldes/custom-functions.php
@cogdog
cogdog / oe-contries.html
Created May 31, 2018 17:03
Ontario Extend Map Animation
<html>
<head>
<title>Countries Visited By Ontario Extenders</title>
<style>
body
{
background-color: #81d4fa;
margin: 0;
@cogdog
cogdog / pummel.sh
Created November 28, 2017 07:13
A version of John Johnston's scripts to generate an mp4 from a flickr set (the latter is my mod)
#!/bin/bash
set -ex
# script to download pile of flickr images from a set and make a movie like the pummelvision service
# modified from https://gist.github.com/troutcolor/a6a82ceeb0dafc5f2c32edb09dfe11ac
# example https://www.youtube.com/watch?v=KOJC5Xco5NM
# needs ffmpeg
# needs sips so a mac John says
# Fill in the param any except the APIKEY can be empty
APIKEY='YOURKEY'
@cogdog
cogdog / timebuddy-sc.php
Created February 28, 2017 19:36
Timebuddy Shortcode for Wordpress multisite
/* ----- shortcode to time buddy widget -------- */
add_shortcode("timebuddy", "do_timebuddy");
function do_timebuddy ( $atts ) {
// generate a Timebuddy widget because WP strips script tags
extract( shortcode_atts( array( "params" => ""), $atts ) );
if ( empty( $params ) ) {
return "Missing parameter! set <code>params=\"xxxxx\" from the Timebuddy generated embed code for <code>src=\"</code> e.g. <code>params=\"h=2643743&md=2/24/2017&mt=19.50&ml=1.00&sts=0&sln=0&wt=ew-ltc\"</code> after the \"?\"";
@cogdog
cogdog / single.php
Created January 18, 2017 21:25
Full width post for wp-bootstrap theme
<?php get_header(); ?>
<div id="content" class="clearfix row">
<div id="main" class="col col-lg-12 clearfix" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
@cogdog
cogdog / quote.html
Created November 30, 2016 07:16
Cycle through Random post content from arganee.world fetched by WP API
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Random Arganee</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Raleway:600,900' rel='stylesheet' type='text/css'>
@cogdog
cogdog / wp-content-filter-gh
Created September 6, 2016 18:36
Wordpress filter to convert copied Markdown
/* ----- change content on output as needed ----- */
function stripFirstLine( $text ) {
// removes first line of text from string
// ----- h/t http://stackoverflow.com/a/7740485/2418186
return substr( $text, strpos($text, "\n")+1 );
}
add_filter( 'the_content', 'cc_cert_content_filter', 20 );
function cc_cert_content_filter( $content ) {
if ( is_page_template( 'page-cert.php' ) ) {
Verifying that +cogdog is my blockchain ID. https://onename.com/cogdog
@cogdog
cogdog / dailyblank-author-tags
Created May 23, 2016 20:24
Dailyblank Fix Missing Author Tags
<ol>
<?php
// This was needed to fix a Daily Blank bug where the author twitter handles were not properly
// added to a Daily blank site. Insert into the magic spot of page-debug.php, go to /debug on your
// site, let it do its work, then remove.
$args = array(
'posts_per_page' => -1,
'meta_key' => 'wAuthor',
@cogdog
cogdog / dailyblank-get-tweets
Created May 23, 2016 20:20
Dailyblank Fetch Some Tweets
<?php
// I used this when testing the twitter fetching,
// it will give you sense of what tweets will be fetched
// for a Daily blank site. Insert into the magic spot of page-debug.php, go to /debug on your
// site, let it do its work, then remove.
$tweets = getTweets( dailyblank_option('twitteraccount'), 200, array('exclude_replies'=>false, 'trim_user' => false ) );