Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Binnion ebinnion

View GitHub Profile
View dropboxOrganize.py
################################################################################################
#
# 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 Nov 9, 2017 — forked from bjorn2404/wordpress_remote_images
WordPress load remote images if they don't exist on the local development server htaccess
View wordpress_remote_images
<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 Aug 24, 2016
This plugin creates filler content every minute via cron. It is meant to be used as a debugging plugin.
View create-filler-content-on-cron.php
<?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 Apr 11, 2016
An integration between Woocommerce and Revolution Sliders that allows adding a slider to the top of a product category.
View kareless-product-sliders.php
<?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
*/
View xml-rpc debu
<!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 wordpress_importer.rb
# 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'
View SASS_Color_Contrast.md

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
Redirect non-admin user in WordPress
View redirect_non_admin.php
<?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;
}
@ebinnion
ebinnion / slideshow.php
Last active Aug 29, 2015
Crane|WEST Slideshow CPT Snippet with Aqua Resizer
View slideshow.php
<?php
$slides = new WP_Query(
array(
'post_type' => 'slideshow',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'asc',
)
);
View multiple-roles-per-user.php
<?php
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*