Skip to content

Instantly share code, notes, and snippets.

View dougbeal's full-sized avatar

Douglas Beal dougbeal

View GitHub Profile
@dougbeal
dougbeal / shelldown-demo
Created July 29, 2018 20:54 — forked from pjeby/shelldown-demo
"You got your markdown in my shell script!" "No, you got your shell script in my markdown!"

Mixed Markdown and Shell Scripting

: By the power of this magic string: ex: set ft=markdown ;:<<'```shell' #, this file is now both a markdown document and an executable shell script. chmod +x it and try running it!

The above line does just what it says. More specifically, when placed within in the first 5 lines and preceded only by blank lines or #-prefixed markdown headers:

  1. The first part of the magic string makes github and various editors (e.g. atom with the vim-modeline packge) treat the file as having markdown syntax (even if the file doesn't have an extension)
  2. The second part (if run in a shell), makes the shell skip execution until it encounters the next ```shell block.

(The line also has to start with a : so that it's valid shell code.)

@dougbeal
dougbeal / parse-response.json
Last active July 19, 2018 05:13
link preview gone wrong
webserver-wordpress_1 | 71.212.132.198 - - [19/Jul/2018:04:51:06 +0000]
"GET /wp-json/link-preview/1.0/parse/?kindurl=https%3A%2F%2Fgithub.com%2Findieweb%2Fwordpress-indieweb%2Fissues&kind=issue HTTP/1.1"
200 4269
"https://dougbeal.com/wp-admin/post.php?post=2006&action=edit"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15"
"-"
@dougbeal
dougbeal / debug.php
Last active July 16, 2018 05:17
issue post kind missing start p tag
{"name":"Feature \u2013 WordPress \u2013 rel-issues link in plugin generated widget when in debug mode","summary":"WordPress debug mode could put link re-issues into each widget bit, and Press-This bookmarklet could allow selection of which one you want to file against\nDuplicate to somewhere","author":{"type":"card","name":"Douglas Beal","url":"https:\/\/dougbeal.com","photo":"https:\/\/secure.gravatar.com\/avatar\/4aef6f46cd0c5c51bbf5c15d4e66b35e?s=125&d=default&r=g"},"publication":"dougbeal","published":"2018-07-15T18:47:04-07:00","updated":"2018-07-15T21:38:48-07:00","url":"https:\/\/dougbeal.com\/2018\/07\/15\/feature-wordpress-rel-issues-link-in-plugin-generated-widget-when-in-debug-mode\/","raw":{"title":"Feature &#8211; WordPress &#8211; rel-issues link in plugin generated widget when in debug mode","type":"article","url":"https:\/\/dougbeal.com\/2018\/07\/15\/feature-wordpress-rel-issues-link-in-plugin-generated-widget-when-in-debug-mode\/","description":"Wordpress debug mode could put link re-issues
@dougbeal
dougbeal / gist:2c4a9c2b953feee91b43906a98d093b2
Last active July 12, 2018 04:26
https://🕸💍.ws indieauth to wordpress login error
The authorization server returned an invalid state parameter
[ 'Verifying ',
'WrxIqLF4eixqnpLnFpmf3A46UxA6KzTIfjVpRqa1ZDjac58sjt3CrujnifmVTvEa27oP3Y41Qt6g41ruxJewoTpJvKFRV2PiAhohOJ4nWuPqswKcfGSqBmfPvMhr9izu',
' with ',
{ me: 'https://dougbeal.com/',
@dougbeal
dougbeal / gist:831de0d3eea410de07ab662f3dd2def3
Created July 12, 2018 03:07
indieweb wordpress plugins
git submodule foreach git remote -v
Entering 'indieauth'
origin https://github.com/indieweb/wordpress-indieauth (fetch)
origin https://github.com/indieweb/wordpress-indieauth (push)
Entering 'indieweb'
origin https://github.com/indieweb/wordpress-indieweb.git (fetch)
origin https://github.com/indieweb/wordpress-indieweb.git (push)
Entering 'indieweb-post-kinds'
origin https://github.com/dshanske/indieweb-post-kinds.git (fetch)
origin https://github.com/dshanske/indieweb-post-kinds.git (push)
@dougbeal
dougbeal / gist:d33bdd3ed8ff29cdfeaf176e25bcc5d2
Last active July 12, 2018 02:10
OwnYourGram fails to upload photo
failed upload
wordpress_1 | 172.18.0.4 - 12/Jul/2018:01:37:03 +0000 "POST /wp-admin/admin-ajax.php" 200
webserver-wordpress_1 | 98.237.185.120 - - [12/Jul/2018:01:37:03 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 34 "https://dougbeal.com/wp-admin/edit.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0" "-"
wordpress_1 | 172.18.0.4 - 12/Jul/2018:01:37:04 +0000 "POST /index.php" 400
webserver-wordpress_1 | 173.230.155.197 - - [12/Jul/2018:01:37:05 +0000] "POST /?micropub=endpoint HTTP/1.1" 400 121 "-" "-" "-"
webserver-wordpress_1 | 2018/07/12 01:37:05 [info] 5#5: *63642 client 173.230.155.197 closed keepalive connection
wordpress_1 | 172.18.0.4 - 12/Jul/2018:01:37:09 +0000 "POST /wp-cron.php" 200
webserver-wordpress_1 | 172.18.0.1 - - [12/Jul/2018:01:37:09 +0000] "POST /wp-cron.php?doing_wp_cron=1531359429.4462358951568603515625 HTTP/1.1" 200 5 "https://dougbeal.com/wp-cron.php?doing_wp_cron=1531359429.4462358951568603515625
function repeatSummonTickets(target) {
$('.gacha-result').text("");
$('.loading img').attr("src", "").attr("src", $('.loading img').data("src"));
$('.loading').show();
var obtained_5 = [];
var obtained_4 = [];
var obtained_3 = [];
var obtained = [];
@dougbeal
dougbeal / test.md
Created May 24, 2017 22:24
Exercise mdrip issue

bash

block0

pwd

block1

(cd .. &amp;&amp; pwd)
@dougbeal
dougbeal / post257.meta
Last active May 20, 2017 20:45
Meta data to debug mf2_syndication field being cleared
https://dougbeal.com/2017/05/19/257/
KeyValue
geo_latitude'47.2772'
geo_longitude'-122.284'
mf2_type'a:1:{i:0;s:7:"h-entry";}'
mf2_content'a:1:{i:0;s:47:"Lavender and Mushrooms - been a wet spring 🤣";}'
mf2_published'a:1:{i:0;s:25:"2017-05-19T20:54:39-07:00";}'
mf2_location'a:1:{i:0;s:20:"geo:47.2772,-122.284";}'
mf2_syndication'a:3:{i:0;s:66:"https://www.facebook.com/10106539500131218/posts/10106543472061438";i:1;s:40:"https://www.instagram.com/p/BUTMAt5FJmW/";i:2;s:53:"https://www.flickr.com/photos/gritmonkey/34648785321/";}'
mf2_place_name'a:1:{i:0;s:26:"Lakeland South, Washington";}'
@dougbeal
dougbeal / Frankenstein.php
Created May 19, 2017 06:01 — forked from miklb/Frankenstein.php
facepiles for WP comments
/**
* Override core Walker_Comment for mf2 & Bulma.
*
* @method __construct
*/
class Independence_Walker_Comment extends Walker_Comment {
/**
* Start the element output.
*
* This opens the comment. Will check if the comment has children or is a stand-alone comment.