Skip to content

Instantly share code, notes, and snippets.

View mannieschumpert's full-sized avatar

Mannie Schumpert mannieschumpert

View GitHub Profile
@mannieschumpert
mannieschumpert / 0_reuse_code.js
Created July 11, 2014 19:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mannieschumpert
mannieschumpert / gist:d056a1b81d0a15c4f76f
Last active August 29, 2015 14:02
A reusable solution for adding element classes in the Genesis framework.
<?php
/**
* General function for adding element classes in Genesis
*/
function add_gen_classes( $attr, $classes, $layout = NULL ){
// If there's a layout parameter, and current layout does not match, return classes unchanged
// This part is pseudo code - not sure if this is the function for testing current layout
if ( $layout && ! genesis_site_layout( $layout ) )
@mannieschumpert
mannieschumpert / SassMeister-input.scss
Created May 25, 2014 17:58
Generated by SassMeister.com.
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// Susy (v2.1.1)
// ----
@import "susyone";
div {color: rgba(#fff,0.9);}
li.gfield {
@mannieschumpert
mannieschumpert / gist:9492274
Last active April 28, 2020 12:31
QuickTip: Make an SVG Library for Your Custom Post Type Icons
<?php
// Create your SVG library function
// Put this at the bottom of your functions.php file,
// or out of the way wherever you like
function menu_icons($icon){
// Store your SVGs in an associative array
$svgs = array(
'microphone' => 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjY0cHgiIGhlaWdodD0iMTAwcHgiIHZpZXdCb3g9IjAgLTIwIDY0IDEyMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNjQgMTAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8Zz4NCgkJPHBhdGggZD0iTTYyLDM2LjIxNWgtM2MtMS4xLDAtMiwwLjktMiwyVjUyYzAsNi42ODYtNS4yNjYsMTgtMjUs
@mannieschumpert
mannieschumpert / gist:9277517
Created February 28, 2014 19:05
If running the new Gravity Forms add-on for Easy Digital Downloads, and don't have a gateway hooked up yet, you can drop this in to return all submissions successful while testing.
<?php
add_filter('edd_gf_default_status','return_all_complete');
function return_all_complete(){
return 'publish';
}
@mannieschumpert
mannieschumpert / SassMeister-input.scss
Created February 23, 2014 01:19
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.5)
// Compass (v1.0.0.alpha.18)
// Susy (v2.0.0.rc.1)
// ----
@import "susyone";
li.gfield {
@mannieschumpert
mannieschumpert / SassMeister-input.scss
Last active August 29, 2015 13:56
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.5)
// Compass (v1.0.0.alpha.18)
// Susy (v2.0.0.rc.1)
// ----
@import "susyone";
li.gfield {
@mannieschumpert
mannieschumpert / gist:8888351
Last active February 22, 2021 05:02
Some filter examples for preventing editing of certain users.
<?php
/**
* Prevent Editing of a specified user
*
* This example shows how you can protect the original admin from being edited or deleted by anyone else
*/
add_filter('map_meta_cap', 'prevent_user_edit', 10, 4 );
function prevent_user_edit( $required_caps, $cap, $user_id, $args ){
$protected_user = 1; // ID of user not editable
@mannieschumpert
mannieschumpert / gist:8886289
Last active August 2, 2020 13:15
Code Examples from Andrew Nacin's "Current User Can Watch This Talk"
<?php
// If you can edit pages, you can edit widgets
add_filter( 'user_has_cap',
function( $caps ) {
if ( ! empty( $caps['edit_pages'] ) )
$caps['edit_theme_options'] = true;
return $caps;
} );
@mannieschumpert
mannieschumpert / gist:8480059
Last active January 3, 2016 14:59
A PHP script to add a list of tasks to Asana via an array.
<?php
$apikey = ""; // Your API key
$workspace = ''; // your project's workspace ID
$project = ''; // your project's ID
$tasks = array(
'Task 1',
'Task 2',
'Task 3'
// etc