Skip to content

Instantly share code, notes, and snippets.

Avatar
🐳
sploosh

Joel Lisenby JoelLisenby

🐳
sploosh
View GitHub Profile
@JoelLisenby
JoelLisenby / jbl_find_replace.php
Last active Apr 20, 2022
Find and Replace Title and Content for Specific Post Type in WordPress with WP_Query
View jbl_find_replace.php
<?php
/* Backup site first before using. This adds a menu to wp-admin so you can run the script.
*** Visiting this menu will automatically run the script!! ***
*/
add_menu_page(
'jbl Find Replace',
'jbl Find Replace',
'manage_options',
'jbl-find-replace',
'jbl_find_replace'
@JoelLisenby
JoelLisenby / functions.php
Last active Feb 19, 2022
Remove Flash of Unstyled Content in WordPress using SiteOrigin Page Builder and Mega Menu
View functions.php
<?php
function head_fouc_script() {
?>
<script>
document.body.style.setProperty("visibility", "hidden", "important");
</script>
<style>
#mega-menu-wrap-primary #mega-menu-primary { /* these IDs may differ depending on the name of your menu. */
visibility: inherit; /* mega menu sets visibility visible and shows if you don't set this */
@JoelLisenby
JoelLisenby / dyndns_linode.sh
Last active Aug 22, 2021
A simple Dynamic DNS script for use with crontab for Linode Domain DNS Records API using dig and linode-cli from python pip
View dyndns_linode.sh
#!/bin/bash
domainid=000000
recordid=0000000
wanip=`dig @resolver4.opendns.com myip.opendns.com +short`
oldip=`linode-cli domains records-view $domainid $recordid --text --no-header --format="target"`
if [ $oldip != $wanip ]
then
linode-cli domains records-update $domainid $recordid --target $wanip
@JoelLisenby
JoelLisenby / usps_accepted_at.php
Last active Jun 23, 2020
Simple PHP function to check if USPS package has been accepted / picked up using official USPS API
View usps_accepted_at.php
<?php
function usps_picked_up( $tracking_number ) {
if( empty( $tracking_number ) || !ctype_alnum( $tracking_number ) ) {
return false;
}
$user_id = "YOUR_USER_ID";
$usps_api_uri = "http://production.shippingapis.com/shippingAPI.dll";
$xml = rawurlencode("<TrackRequest USERID=\"". $user_id ."\">
@JoelLisenby
JoelLisenby / getUrlWithParams.js
Last active May 15, 2020
Add/update or Remove URL parameters from the provided URL
View getUrlWithParams.js
/* getUrlWithParams()
* Add/update or remove url parameters from the provided url.
* Example: getUrlWithParams({'tab':tab_name},['remove']);
*/
var getUrlWithParams = function(url, add_update, remove = []) {
var url = new URL(url);
var splita = url.search.substr(1).split('&');
var params = {};
var merged = {};
@JoelLisenby
JoelLisenby / WP-JSON-Parser.html
Last active Feb 28, 2020
WP-JSON HTML Parser
View WP-JSON-Parser.html
<!doctype html>
<html>
<head>
<script>
const req = new XMLHttpRequest();
req.addEventListener('load', function(e) {
var response = JSON.parse( e.target.response );
var page_html = response.content.rendered;
@JoelLisenby
JoelLisenby / find_invisible_horizontal_scroll_elements.js
Last active Dec 13, 2019
JavaScript to find hidden horizontal scroll elements. Paste into browser JS console and hit enter.
View find_invisible_horizontal_scroll_elements.js
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
);
@JoelLisenby
JoelLisenby / off.reg
Created Jun 5, 2019 — forked from CHEF-KOCH/off.reg
Windows 10 ads, turn it off!
View off.reg
Windows Registry Editor Version 5.00
; Turn off File Explorer ads
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"ShowSyncProviderNotifications"=dword:00000000
; Turn off Start Menu suggestions
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager]
"SystemPaneSuggestionsEnabled"=dword:00000000
View hero_video.html
<div id="hero_video_container">
<video autoplay muted loop id="hero_video">
<source src="/videos/video.mp4" type="video/mp4" />
<source src="/videos/video.webm" type="video/webm" />
</video>
</div>
<style>
#hero_video_container {
position: relative;
width: 100%;
@JoelLisenby
JoelLisenby / ffmpeg.sh
Last active Sep 6, 2019
ffmpeg video encoding for web (chrome, firefox, safari, etc)
View ffmpeg.sh
# h265
ffmpeg -i input.mp4 -c:v libx265 -vf scale=1280:720 -pix_fmt yuv420p output.mp4
# h265 with colorspace specified
ffmpeg -i input.mp4 -c:v libx265 -vf scale=1280:720 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 output.mp4
# h265 with colorspace specified and no audio
ffmpeg -i input.mp4 -c:v libx265 -vf scale=1280:720 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 -an output.mp4
# webm