Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@oneblackcrayon
oneblackcrayon / gist:7db8009288a78096367dbcb0b844e476
Created January 15, 2019 15:13 — forked from chuckwagoncomputing/gist:4234127
pbcopy ssh public key to your clipboard
#pbcopy < ~/.ssh/id_rsa.pub
#or
cat ~/.ssh/id_rsa.pub | pbcopy
@oneblackcrayon
oneblackcrayon / wp-config-local-sample.php
Created December 31, 2018 02:33 — forked from bhubbard/wp-config-local-sample.php
This is my Template for a wp-config file.
<?php
################################################################################
// Custom WordPress Local Config
// Use only for Development
// https://gist.github.com/bhubbard/8428583
################################################################################
/* Database Connection Info */
define('DB_NAME', '');
define('DB_USER', '');
/**
* A validation script for use with a "naked" Mailchimp embedded form.
*
* credit to this post on CSS-Tricks:
* https://css-tricks.com/form-validation-part-4-validating-mailchimp-subscribe-form/
*
* I added a couple of minor Bootstrap 4 classes
**/
@oneblackcrayon
oneblackcrayon / uofmi.scss
Last active October 28, 2018 00:27
Internet brand consistencies for The University of Michigan web presences
$maize: #f5c300 !default;
$mblue: #00274c !default;
$mwhite: rgba(255,255,255,0.999);
$umgrey: #45494d !default;
$light-grey: lighten($umgrey, 62%);
html, body{
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans",
@oneblackcrayon
oneblackcrayon / acf-work-meta.php
Last active July 13, 2018 05:52
ACF - Advanced Custom Fields for a custom post type that has meta fields.
<?php
$work_year = get_field('work_year');
$work_url = get_field('work_url');
$work_tasks = get_field_object('work_tasks', $post->ID);
$value = $work_tasks['value'];
$label = $work_tasks['choices'][ $value ];
$work_category= get_field('work_category');
$work_cat_link = get_term_link( $work_category);
$work_screenshot = get_field('work_screenshot');
$size = 'thumbnail';
@oneblackcrayon
oneblackcrayon / chruby-auto.sh
Created July 5, 2018 23:22
Fix Bash & Chruby
# From https://github.com/postmodern/chruby/issues/399
# ryanong commented on Mar 26 •
# Was trying to figure out why this didn't work.
# So iterm2 includes https://github.com/rcaloras/bash-preexec which breaks the trap 'command' DEBUG that is used in auto.sh
# If you are using iterm I suggest using
unset RUBY_AUTO_VERSION
@oneblackcrayon
oneblackcrayon / gist:e82834a326f18b92e268037f7fd3688c
Created July 5, 2018 23:03 — forked from samnang/gist:1759336
Install Bash version 4 on MacOS X
# Install Bash 4 using homebrew
brew install bash
# Or build it from source...
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xzf bash-4.2.tar.gz
cd bash-4.2
./configure --prefix=/usr/local/bin && make && sudo make install
# Add the new shell to the list of legit shells
@oneblackcrayon
oneblackcrayon / acf-debug-example.php
Created June 30, 2018 18:10
ACF Debug Example for WordCamp Grand Rapids 2018
<?php
/**
* Let's Debug ACF fields
* @link: https://www.advancedcustomfields.com/resources/debug/#debugging-data
*/
// Using incorrect field name we get NULL
$text = get_field('my_text_field_');
echo '<pre>';
var_dump($text);
@oneblackcrayon
oneblackcrayon / mu-sanitize-filename.php
Created June 16, 2018 21:14 — forked from wpchannel/mu-sanitize-filename.php
Clean file name when uploading in WordPress
<?php if (!defined('ABSPATH')) die('Restricted Area');
/*
* Plugin Name: Sanitize File Name
* Description: Clean file name when uploading files in WordPress.
* Version: 20180218
* Author: Mickaël Gris (Neticpro)
* Author URI: https://wpchannel.com/renommer-automatiquement-fichiers-accentues-wordpress/
*/
@oneblackcrayon
oneblackcrayon / send-new-notificcation.php
Created August 10, 2017 20:40
Pick the specific users to send an email to notifying them about a new post.
<?php
/*
Plugin Name: Send New Notification
Plugin URI: http://oneblackcrayon.com
Description: Pick the specific users to send an email to notifying them about a new post.
License: GPLv2 or later
*/
// Taken from ACF website