Skip to content

Instantly share code, notes, and snippets.

View cogdog's full-sized avatar

Alan Levine cogdog

View GitHub Profile
@cogdog
cogdog / gdrive-shortcode
Created December 11, 2014 21:11
Add options to gdrive shortcode
unction gdrive_shortcode( $atts, $content = null ) {
// options for different kinds of embeds, default is folder view
extract( shortcode_atts( array( "what" => "folder"), $atts));
switch ($what) {
case 'folder':
return '<iframe src="https://drive.google.com/embeddedfolderview?id=' . $content . '#list" frameborder="0" width="100%" height="500px" scrolling="auto"> </iframe>';
break;
case 'somethingelse':
@cogdog
cogdog / dailyblank-seed-counts
Created May 23, 2016 20:05
Daily Blank Seed Counts
<ol>
<?php
// This will back create the response counts and generate some random visit counts
// 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.
$args = array(
'posts_per_page' => -1,
'post_type' => 'post',
@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 ) );
@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',
Verifying that +cogdog is my blockchain ID. https://onename.com/cogdog
@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' ) ) {
@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 / 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 / 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 / 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'