Skip to content

Instantly share code, notes, and snippets.

View ebinnion's full-sized avatar

Eric Binnion ebinnion

View GitHub Profile
@ebinnion
ebinnion / Fix invisible inputs
Created November 16, 2022 16:08 — forked from snake66/Fix invisible inputs
Fix styling for "invisible" input fields in firefox.
// ==UserScript==
// @name Fix input fields
// @namespace snake66
// @description Fix input fields with unreadable text
// @include http://*/*
// @include https://*/*
// @version 2
// @grant none
// ==/UserScript==
@ebinnion
ebinnion / github_pulls.sh
Created August 13, 2022 03:30
A bash script to export all PRs for a given repository.
#!/bin/bash
# This script requires jq to be installed and available in the path.
#
# To create a personal access token, follow the instructions here:
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
TOKEN=$1
ORG=$2
REPO=$3
################################################################################################
#
# Script to organize pictures uploaded from Mobile Devices to Dropbox's Camera Upload folder
#
# Daniel Spillere Andrade - www.danielandrade.net
#
################################################################################################
import os, time
import glob
@ebinnion
ebinnion / wordpress_remote_images
Created November 9, 2017 15:59 — forked from bjorn2404/wordpress_remote_images
WordPress load remote images if they don't exist on the local development server htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/(.*)$
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads/%1 !-f
RewriteRule ^wp-content/uploads/(.*)$ http://www.remotesite.com/wp-content/uploads/$1 [R=301,L]
</IfModule>
@ebinnion
ebinnion / create-filler-content-on-cron.php
Created August 24, 2016 21:29
This plugin creates filler content every minute via cron. It is meant to be used as a debugging plugin.
<?php
/*
Plugin Name: Meaty Filler Content via Cron
Plugin URI: https://manofhustle.com
Description: Debug plugin which creates meaty filler content from the cron.
Version: 0.1.0
Author: ebinnion
Author URI: https://manofhustle.com
*/
@ebinnion
ebinnion / kareless-product-sliders.php
Created April 11, 2016 23:06
An integration between Woocommerce and Revolution Sliders that allows adding a slider to the top of a product category.
<?php
/*
Plugin Name: Kareless Product Sliders
Plugin URI: https://kareless.com
Description: Allows you to add a Revolution slider to the top of a WooCommerce product archive
Version: 0.1.0
Author: Eric Binnion
Author URI: https://manofhustle.com
Text Domain: kareless-product-sliders
*/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /xmlrpc.php
on this server.</p>
</body></html>
# View my Jekyll blog http://paulstamatiou.com and my jekyll migration post http://paulstamatiou.com/how-to-wordpress-to-jekyll/
#
#
# based on the import script by icebreaker, which is based on mojombo's
# https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# https://gist.github.com/303570
# edited to rewrite image URLs to use my CloudFront URL
require 'rubygems'
require 'sequel'

Pure SASS-adaption of Lea Verou's contrast-ratio javascript. Can be useful when eg. generating colored buttons from a single supplied color as you can then check which out of a couple of text colors would give the best contrast.

This script currently lacks the support for alpha-transparency that Lea supports in her script though.

In addition to the color-contrast adaption there's also some math methods that were needed to be able to calculate the exponent of a number and especially so when the exponent is a decimal number. A 2.4 exponent is used to calculate the luminance of a color and calculating such a thing is not something that SASS supports out of the box and not something I found a good pure-SASS script for calculating and I much prefer pure-SASS over ruby extensions. The math methods might perhaps be unecessary though if you're running Compass or similar as they may provide compatible math methods themselves.

Normal usage: `color: pick_best_color(#f00

@ebinnion
ebinnion / redirect_non_admin.php
Created May 23, 2014 20:40
Redirect non-admin user in WordPress
<?php
add_action( 'wp_login', 'redirect_non_admins', 10, 2 );
function redirect_non_admins( $user_id, $user ) {
$user = wp_get_current_user();
$admin_roles = array('administrator');
if( 0 == count( array_intersect( $admin_roles, $user->roles ) ) ) {
wp_redirect( home_url() );
exit;
}