Skip to content

Instantly share code, notes, and snippets.

View ThatGuySam's full-sized avatar
🍉
Discovering the wonders of JAMStack

Sam Carlton ThatGuySam

🍉
Discovering the wonders of JAMStack
View GitHub Profile
@ThatGuySam
ThatGuySam / grecatpcha.js
Created April 6, 2021 20:42
Google Recaptcha V3 ES Module feat Netlify and Axios
// .env
// CAPTCHA_SITE='...'
// CAPTCHA_SECRET='...'
import axios from 'axios'
// https://github.com/dlqs/serverless-captcha/blob/master/functions/captcha.js
export const scriptUrl = `https://www.google.com/recaptcha/api.js?render=${process.env.CAPTCHA_SITE}&onload=onRecaptchaLoadCallback`
@ThatGuySam
ThatGuySam / get-font-variations-used.js
Created April 5, 2021 20:01
Find all unique font weight and style combinations in Javascript
const fontVariationsUsed = new Set()
Array.from(document.querySelectorAll('*')).forEach( element => {
const computedStyle = window.getComputedStyle( element )
const hasFontFamily = computedStyle.fontFamily.includes('Montserrat')
if ( hasFontFamily ) {
// Add variation to list
fontVariationsUsed.add(`${computedStyle.fontWeight} ${computedStyle.fontStyle}`)
@ThatGuySam
ThatGuySam / release-notes.txt
Created February 16, 2021 18:01
DisplayLink Manager Release Notes 1.3.0
=============================================================================
=============================================================================
DisplayLink macOS Application Release Note
Version: v1.3.0
Build: posix/55-8038-gfe36308bc9e (111)
Date: 1st February 2021
function getURLType ( url ) {
if (url.match(/Youtube URL Regex/g)) return 'youtube'
if (url.match(/MP4 URL Regex/g)) return 'mp4'
// Otherwise
return 'image'
}
const urlType = getURLType (url)
@ThatGuySam
ThatGuySam / allowed-block-types.php
Last active October 31, 2023 08:06
Limit allowed Gutenberg Blocks with full list of native Wordpress Blocks
<?php
// Hook up function to allowed_block_types filter
add_filter( 'allowed_block_types', 'set_allowed_block_types' );
/**
* Set allowed gutenburg block types
* https://rudrastyh.com/gutenberg/remove-default-blocks.html
*/
@ThatGuySam
ThatGuySam / vlc-elgato-catpure.md
Last active January 24, 2024 14:37
Windows Shortcut Target for VLC to show Elgato HD60S Video Stream of PS4 Pro

How to Capture an Elgato Device(or any capture device) in VLC


Make a copy of your normal VLC Shortcut and paste this into it's Target under Properties and customize according to you're system and setup.

"C:\Program Files\VideoLAN\VLC\vlc.exe" dshow:// :dshow-vdev="Game Capture HD60 S (Video) (#01)" :dshow-adev="Game Capture HD60 S (Audio) (#01)" :dshow-aspect-ratio="16:9" :dshow-audio-samplerate=48000 :dshow-audio-channels=2 :live-caching=0 :dshow-fps=60

@ThatGuySam
ThatGuySam / edges.css
Created January 18, 2020 19:34
See edges of all elements on a page
* {
outline: 1px solid red !important;
border: 1px solid red !important;
}
@ThatGuySam
ThatGuySam / wp-env-color-scheme.php
Last active July 28, 2022 21:26
Set custom admin color scheme for your local Wordpress environment
<?php
// Force Color Scheme for environments
// so that you're less likely to accidentally
// make a DEV update to a Production WordPress
// instance.
add_filter( 'get_user_option_admin_color', 'update_user_option_admin_color', 5 );
function update_user_option_admin_color( $color_scheme ) {
if (defined('WP_LOCAL_DEV') && WP_LOCAL_DEV) return 'ocean';
@ThatGuySam
ThatGuySam / shortcode-class.php
Created May 16, 2019 14:52
Wordpress Shortcode Class
<?php
class Cool_Shortcode_Name {
static $add_script;
static function init() {
add_shortcode('cool_shortcode_name', array(__CLASS__, 'handle_shortcode'));
add_action('init', array(__CLASS__, 'register_script'));
@ThatGuySam
ThatGuySam / vimeo-playerjs-methods.txt
Last active January 22, 2019 15:12
A list of methods for the player instance from Vimeo's Player.js as of January 2019
Example: player._addCard(options)
_addCard
_fireEvent
_hideOutro
_overrideControlbarBehavior
_removeCard
_setControlbarVisibility
_setEmailCapture
_setEmbedEditor