Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
building things

Chuck Reynolds chuckreynolds

🤖
building things
View GitHub Profile
@johnmurch
johnmurch / links-console.js
Created September 11, 2020 01:35
PASTE INTO CHROME CONSOLE
View links-console.js
@Oceas
Oceas / wds-hello-world.php
Last active January 5, 2023 14:16
WDS WP-CLI 101 Complete
View wds-hello-world.php
<?php
/*
Plugin Name: WDS Hello World
Plugin URI: https://webdevstudios.com/
Description: Teaching the basics of WP-CLI
Author: Web Dev Studios
Version: 1.0.0
Author URI: https://webdevstudios.com/
*/
class WDS_CLI {
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active March 20, 2023 23:14
58 bytes of css to look great nearly everywhere
View 55-bytes-of-css.md

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@tessak22
tessak22 / functions.php
Created March 12, 2019 12:06
Hero Gutenberg Block using Advanced Custom Fields 5.8 Pro
View functions.php
/**
* Register hero block
*/
add_action('acf/init', 'hero');
function hero() {
// check function exists
if( function_exists('acf_register_block') ) {
// register a hero block
@drewm
drewm / shoot-sharing-image.js
Last active April 30, 2021 06:24
Dynamic Social Sharing Images
View shoot-sharing-image.js
const puppeteer = require('puppeteer');
const imagemin = require('imagemin');
const imageminPngquant = require('imagemin-pngquant');
// Get the URL and the slug segment from it
const url = process.argv[2];
const segments = url.split('/');
const slug = segments[segments.length-2];
(async () => {
@AdamSoucie
AdamSoucie / gist-block.js
Created August 17, 2018 19:19
Block.js file for Gist Gutenberg Block
View gist-block.js
/**
* BLOCK: wds-gist
*/
// Import CSS.
import './style.scss';
import './editor.scss';
const { __ } = wp.i18n; // Import __() from wp.i18n
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
@pento
pento / php-block.js
Last active February 9, 2023 05:25
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
View php-block.js
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@jonoalderson
jonoalderson / userAgentSEO.php
Last active November 29, 2018 09:13
Looks up the user agent against a known list, and outputs a HTML comment
View userAgentSEO.php
<?php
// Quick script to check and output the user agent in a HTML comment
// Jono Alderson [https://www.jonoalderson.com]
// =================================
// Google user agent strings are sourced from
// [https://support.google.com/webmasters/answer/1061943?hl=en]
// Feel free to add/edit definitions
// =================================
// Last updated: 20/03/2018
@bcnzer
bcnzer / postman-pre-request.js
Last active March 12, 2023 22:23
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
View postman-pre-request.js
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@smiley
smiley / README.md
Last active February 16, 2023 10:15
How to make an automatic "stream's live" notification for your Discord server
View README.md

Making an automatic Twitch -> Discord notification (using IFTTT)

So you went live and you want everyone to know. Here's how you do it:

Part 1 - Register on IFTTT

Go to https://ifttt.com/ and create an account (if you don't already have one)

Part 2 - Make a Discord Webhook

  • Find the Discord channel in which you would like to send Tweets.
  • In the settings for that channel, find the Webhooks option and create a new webhook. Note: This URL should be kept private. It allows anyone to write messages to that specific channel using that specific URL. Keep it safe!