Skip to content

Instantly share code, notes, and snippets.

Avatar
🍉
Discovering the wonders of JAMStack

Sam Carlton ThatGuySam

🍉
Discovering the wonders of JAMStack
View GitHub Profile
@ThatGuySam
ThatGuySam / grecatpcha.js
Created Apr 6, 2021
Google Recaptcha V3 ES Module feat Netlify and Axios
View grecatpcha.js
// .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 Apr 5, 2021
Find all unique font weight and style combinations in Javascript
View get-font-variations-used.js
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 Feb 16, 2021
DisplayLink Manager Release Notes 1.3.0
View release-notes.txt
=============================================================================
=============================================================================
DisplayLink macOS Application Release Note
Version: v1.3.0
Build: posix/55-8038-gfe36308bc9e (111)
Date: 1st February 2021
View getURLType.js
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 Oct 6, 2021
Limit allowed Gutenberg Blocks with full list of native Wordpress Blocks
View allowed-block-types.php
<?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 Sep 19, 2021
Windows Shortcut Target for VLC to show Elgato HD60S Video Stream of PS4 Pro
View vlc-elgato-catpure.md

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 Jan 18, 2020
See edges of all elements on a page
View edges.css
* {
outline: 1px solid red !important;
border: 1px solid red !important;
}
@ThatGuySam
ThatGuySam / wp-env-color-scheme
Created Sep 4, 2019
Set custom admin color scheme for your local Wordpress environment
View wp-env-color-scheme
<?php
// Force Color Scheme for environments
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';
return 'default';
}
@ThatGuySam
ThatGuySam / shortcode-class.php
Created May 16, 2019
Wordpress Shortcode Class
View shortcode-class.php
<?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 Jan 22, 2019
A list of methods for the player instance from Vimeo's Player.js as of January 2019
View vimeo-playerjs-methods.txt
Example: player._addCard(options)
_addCard
_fireEvent
_hideOutro
_overrideControlbarBehavior
_removeCard
_setControlbarVisibility
_setEmailCapture
_setEmbedEditor