Skip to content

Instantly share code, notes, and snippets.

View cogdog's full-sized avatar

Alan Levine cogdog

View GitHub Profile
@cogdog
cogdog / gist:d55b3fb59082f9bf14686c1d6feeb365
Created March 28, 2024 23:11
Share openly Bookmarklet
This is a quick and sloppy bookmarklet to make use of Ben Werd's Share Openly https://werd.io/2024/share-openly
From any page you can select a but of text to include in your shared prompt, click the bookmarklet or enter in a dialog box, all passed to
ShareOpenly.org to enable a share post to your preferred service.
Create a new bookmark on your browser bar (for now I will have to assume you can dio a new one from scratch), name it
whatever you like, and for the url enter
javascript:q=location.href;t=getSelection()+'';if(!t)%7Bvoid(t=prompt('Share Openly with text...',''))%7D;if(t) location.href='https://shareopenly.org/share/?url='+encodeURIComponent(q)+'&text='+encodeURIComponent(t);
@cogdog
cogdog / fetch.php
Last active February 22, 2023 00:55
Fetch Mastodon Mentions with PHP
<?php
// Mastodon account details, hardwired for dev, add yours as needed
$creds = [
'account' => '', //username in form @user@instance.social
'host' => '', // url without trailing slash e.g. https://instance.social
'url' => '', // user account URL https://instance.social/@user
'token' => '', // access token created in Edit Profile-> Development
'getcount' => 10 // number of posts to get,max=30
];
?>
@cogdog
cogdog / altChecker.js
Last active November 22, 2021 00:44 — forked from bennettscience/altChecker.js
Mod
/* Modified version of Brian Bennett's bookmarklet for blurring
images in a page lacking alt descriptions, added class for missing alts */
// code version
(function() {
'use strict';
function addCssRule(rule) {
var head, style;
head = document.querySelector('head');
@cogdog
cogdog / accordion.md
Last active May 21, 2021 17:57
GitHub Does Accordions!

Can I Haz Accordions

What Are Accordions For?

The H5P documentation spells it out nicely:

Reduce the amount of text presented to readers by using this responsive accordion. Readers decide which headlines to take a closer look at by expanding the title. Excellent for providing an overview with optional in-depth explanations.

@cogdog
cogdog / gist:ab8117cf21d9fbe57c8df6336ac63c26
Created January 13, 2020 15:36
VVV Provision Log Fail 2
cogdog:vagrantly cogdog$ vagrant up --provision
__ ___ ___ __ ____
\ \ / \ \ / \ \ / / |___ \
\ \ / / \ \ / / \ \ / / __) |
\ V / \ V / \ V / / __/
\_/ \_/ \_/ |_____|
Varying Vagrant Vagrants v2.1.0-master
Docs: https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv
@cogdog
cogdog / gist:107a02f6dac2e15b2e4e1306d7e17d94
Created January 13, 2020 15:34
VVV Provision Fail Log1
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Setting the name of the VM: vagrantly_f801a52a224
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
@cogdog
cogdog / splotbox-extender-splotca.php
Last active July 5, 2021 05:30
Version of the SPLOT Extender in use at SPLOT.ca/box
<?php
/*
Plugin Name: SPLOTbox Extender
Plugin URI: https://github.com/cogdog/splotbox-extender
Description: With some elbow grease manual coding, you can extend the functionality of a SPLOTbox site to support more media sites than the original theme.
Version: 0.61
License: GPLv2
Author: Alan Levine
Author URI: https://cog.dog
*/
@cogdog
cogdog / form.php
Created July 2, 2019 21:50
Get Tinymce text editor contents
/* php form creation
<?php if ( trucollector_option('caption_field') == 's'):?>
<input id="wRichText" type="hidden" value="0">
<textarea name="wText" id="wText" rows="4" tabindex="4"><?php echo stripslashes( $wText );?></textarea><p style="font-size:0.8rem">To create hyperlinks use this shortcode<br /><code>[link url="http://www.themostamazingwebsiteontheinternet.com/" text="the coolest site on the internet"]</code><br />If you omit <code>text=</code> the URL will be the link text.</p>
@cogdog
cogdog / wp-posted-today.php
Created January 14, 2019 02:56
shortcode to output all posts published on current date
/* outputs a list of all posts published in the current day in previous years
This will be done up properly as plugin, this is just current code inserted
in functions.php for CogDogBlog - see demo at https://cogdogblog.com/this-day
Inspired by John Johnston's version
https://gist.github.com/troutcolor/ed3c72ea54a0ee8c814382eb24806cee
*/
add_action( 'init', 'cdb_postedtoday_shortcode' );
@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