Skip to content

Instantly share code, notes, and snippets.

View chuckreynolds's full-sized avatar
🤖
building things

Chuck Reynolds chuckreynolds

🤖
building things
View GitHub Profile
@chuckreynolds
chuckreynolds / abstract.json
Last active December 15, 2023 23:14
Wikimedia Enterprise API — Results for article "Squirrel" @ 2023 Dec 15. On-demand API response for Article Body, both Wikitext and HTML (provided exclusively by Wikimedia Enterprise), Abstract, Short Description fields, and beta endpoint resp for Infobox & article body Sections. https://enterprise.wikimedia.com
"abstract": " Squirrels are members of the family Sciuridae, a family that includes small or medium-size rodents. The squirrel family includes tree squirrels, ground squirrels, and flying squirrels. Squirrels are indigenous to the Americas, Eurasia, and Africa, and were introduced by humans to Australia. The earliest known fossilized squirrels date from the Eocene epoch, and among other living rodent families, the squirrels are most closely related to the mountain beaver and to the dormice.",
@chuckreynolds
chuckreynolds / abstract.json
Created December 15, 2023 22:34
Wikimedia Enterprise API — Results for article "Squirrel
"abstract": " Squirrels are members of the family Sciuridae, a family that includes small or medium-size rodents. The squirrel family includes tree squirrels, ground squirrels, and flying squirrels. Squirrels are indigenous to the Americas, Eurasia, and Africa, and were introduced by humans to Australia. The earliest known fossilized squirrels date from the Eocene epoch, and among other living rodent families, the squirrels are most closely related to the mountain beaver and to the dormice.",
@chuckreynolds
chuckreynolds / wordpress-remove-block-suggestions.php
Created October 7, 2022 17:30
WordPress Remove Block Suggestions when viewing the Block Directory in WP Admin.
// Remove Block Suggestions in wp-admin Block Directory
function chuckdev_remove_block_directory() {
wp_add_inline_script(
'wp-block-editor',
"wp.domReady( () => wp.plugins.unregisterPlugin( 'block-directory' ) )"
);
}
add_action( 'admin_enqueue_scripts', 'chuckdev_remove_block_directory' );
@chuckreynolds
chuckreynolds / wikimedia-enterprise-auth-postman-prerequest.js
Created January 20, 2022 00:34
Postman Collection Pre-Request script to get access token for Wikimedia Enterprise Auth
const wmeAuthUrl = 'https://auth.enterprise.wikimedia.com/v1/login';
const wmeUsername = pm.collectionVariables.get("wmeUsername");
const wmePassword = pm.collectionVariables.get("wmePassword");
const getTokenRequest = {
method: 'POST',
url: wmeAuthUrl,
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
@chuckreynolds
chuckreynolds / twitch-helix-oauth2-postman-prerequest.js
Last active January 8, 2022 02:06
Postman Pre-Request script to get access token for Twitch OAuth2
/*
* Twitch Helix OAuth2 Postman Pre-Request Script
* @see https://dev.twitch.tv/docs/authentication#registration
* @see https://learning.postman.com/docs/writing-scripts/pre-request-scripts/
*/
const authUrl = 'https://id.twitch.tv/oauth2/token';
const clientId = pm.collectionVariables.get('clientId');
const clientSecret = pm.collectionVariables.get('clientSecret');
@chuckreynolds
chuckreynolds / nodejs-github-webhook-webservice.md
Created October 21, 2019 23:56
How to Use Node.js and Github Webhooks to Keep Remote Projects in Sync - works for public repos only. Just storing this here for reference.
client.on('message', (channel, tags, message, self) => {
if(self) return;
const { badges, 'badge-info': badgeInfo } = tags;
let isSubscriber = false;
let monthsSubbed = -1;
if(badges) {
isSubscriber = badges.subscriber || badges.founder;
if(isSubscriber) {
monthsSubbed = badgeInfo.subscriber || badgeInfo.founder;
}
<!DOCTYPE html>
<html>
<head>
<title>Lazy load youtube embed</title>
<meta charset="UTF-8" />
</head>
<body>
<main>
<h1>Example of a lazy loaded embedded YouTube video</h1>
<iframe
@chuckreynolds
chuckreynolds / functions.php
Created June 29, 2019 21:42 — forked from tessak22/functions.php
Hero Gutenberg Block using Advanced Custom Fields 5.8 Pro
/**
* Register hero block
*/
add_action('acf/init', 'hero');
function hero() {
// check function exists
if( function_exists('acf_register_block') ) {
// register a hero block