Skip to content

Instantly share code, notes, and snippets.

View rniswonger's full-sized avatar
🖖

Ryan Niswonger rniswonger

🖖
View GitHub Profile
@jonathanstark
jonathanstark / verify-google-recaptcha-with-php
Last active March 8, 2024 18:24
Verify Google reCAPTCHA with PHP
#
# Verify captcha
$post_data = http_build_query(
array(
'secret' => CAPTCHA_SECRET,
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
)
);
$opts = array('http' =>
@retlehs
retlehs / header.php
Created April 29, 2015 04:55
Sage header template for Bootstrap top navbar component
<?php
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker
// somewhere in your theme.
?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
@mattradford
mattradford / licence activation.php
Last active October 28, 2023 19:25
ACF5 Pro licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.
// Place this in wp-config
define( 'ACF_5_KEY', 'yourkeyhere' );
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function auto_set_license_keys() {
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) {
$save = array(
'key' => ACF_5_KEY,
@bjorn2404
bjorn2404 / wp_kses_post_tags.php
Last active April 22, 2024 15:08
WordPress allow iFrames with wp_kses_post filter
<?php
/**
* Add iFrame to allowed wp_kses_post tags
*
* @param array $tags Allowed tags, attributes, and/or entities.
* @param string $context Context to judge allowed tags by. Allowed values are 'post'.
*
* @return array
*/
@jsonmaur
jsonmaur / bzexcluderules_editable.xml
Last active April 9, 2024 04:47
Backblaze Custom Exclude
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/_build/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/deps/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@jonathanmoore
jonathanmoore / gist:c0e0e503aa732bf1c05b7a7be4230c61
Last active January 17, 2024 21:47 — forked from carolineschnapp/gist:1083007
Linked options helper methods for Shopify. See this: http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options - Updated to work with sectioned themes (tested with District)
<script>
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus
// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore
/*
Updated to work with sectioned themes
- Added required methods from the deprecated options_selection.js
- Triggers an initial variant change
- Hides sold out variants with only one option
@TeddyGandon
TeddyGandon / _bga_ide_helper.php
Last active July 7, 2020 00:43
This an IDE helper for developing games on Board Game Arena Studio. Feel free to use it in your preferred IDE to get out these ugly undefined methods errors and to have a direct documentation to classes / methods.
<?php
/**
* This an IDE helper for developing games on Board Game Arena Studio.
* Feel free to use it in your preferred IDE to get out these ugly undefined methods errors and to have a direct
* documentation to classes / methods.
*
* @author Teddy Gandon
* @see https://gist.github.com/TeddyGandon/9e3183475252203b1ede192688b463cd
*/
@matthewbeta
matthewbeta / scrim-gradient.scss
Last active January 22, 2024 15:52
A simple little SCSS mixin for creating scrim gradients
/*
A simple little SCSS mixin for creating scrim gradients
Inspired by Andreas Larson - https://github.com/larsenwork
https://css-tricks.com/easing-linear-gradients/
*/
@mixin scrimGradient($startColor: $color-black, $direction: 'to bottom') {
$scrimCoordinates: (
@sgaulding
sgaulding / own.dg.theme
Last active October 6, 2023 11:09
SmartGit Dark Theme (SmartGit Version 17.1)
# This file lists the color values of the default dark theme.
# Each line starting with a # is a comment.
# To overwrite certain colors remove the leading # and change the color values.
# The "extends" line defines which color definitions to use if none is found here.
extends=deepgit-dark-theme.properties
# The "preferredEditorTheme" line determines what editor theme should be used by default ('light' or 'dark').
preferredEditorTheme=dark
@rmpel
rmpel / wp-499-up-fix-csv-upload.php
Last active January 2, 2022 15:01
A filter (an mu-plugin) to restore CSV upload functionality to WordPress 4.9.9 and up.
<?php
/**
* Restore CSV upload functionality for WordPress 4.9.9 and up
*/
add_filter('wp_check_filetype_and_ext', function($values, $file, $filename, $mimes) {
if ( extension_loaded( 'fileinfo' ) ) {
// with the php-extension, a CSV file is issues type text/plain so we fix that back to
// text/csv by trusting the file extension.
$finfo = finfo_open( FILEINFO_MIME_TYPE );
$real_mime = finfo_file( $finfo, $file );