Skip to content

Instantly share code, notes, and snippets.

View ejdanderson's full-sized avatar
🗿
mostly

Evan Anderson ejdanderson

🗿
mostly
View GitHub Profile
@ejdanderson
ejdanderson / style.css
Created March 20, 2012 06:32
FavePersonal Child Theme style.css
/*
Theme Name: FavePersonal Child
Theme URI: http://example.com/
Description: Child theme for the FavePersonal Theme
Author: Your name here
Author URI: http://example.com/about/
Template: favepersonal
Version: 1.0
*/
@ejdanderson
ejdanderson / classe_references
Last active October 2, 2015 03:38
differences in class name references
<?php
class Foo {
function echo_classes() {
echo __CLASS__;
echo get_class();
echo get_class($this);
echo get_called_class();
}
}
@ejdanderson
ejdanderson / gist:2370749
Created April 12, 2012 20:27
String Evaluates to 0
<?php
$arr = array();
$arr['foo'] = 'bar';
// 'boo' evaluates to 0
echo $arr['foo']['boo']; // b
// This evaluates as true and echos
if (isset($arr['foo']['boo'])) {
@ejdanderson
ejdanderson / bash prompt
Created June 23, 2012 03:08
Bash token prompt
#!/bin/bash
if [ -z $1 ]; then
echo "Usage: inputs.sh file.txt"
else
codes=$(grep -o "###.*###" $1)
inputs=$(echo $codes | sed 's/#//g')
for x in $inputs; do
#Check if the variable is empty
@ejdanderson
ejdanderson / gist:3996147
Created November 1, 2012 20:09
WP Options Page Setup with button to run action
<?php
function create_menu() {
add_options_page(__('Plugin Settings', 'ejda'), __('Plugin Settings', 'ejda'), 'manage_options', 'ejda-slug', 'options_page_content');
}
add_action('admin_menu', 'create_menu');
function options_page_content() {
?>
<div class="wrap">
@ejdanderson
ejdanderson / taxonomy-register.php
Last active December 21, 2015 09:28
Full list of taxonomy arguments and example of registering them
<?php
$taxonomies = array(
'taxonomy-slug' => array(
'labels' => array(
'name' => __('Genres', 'textdomain'),
'singular_name' => __('Genre', 'taxonomy singular name', 'textdomain'),
'menu_name' => __('Genre', 'textdomain'),
'all_items' => __('All Genres', 'textdomain'),
'edit_item' => __('Edit Genre', 'textdomain'),
'view_item' => __('View Genre', 'textdomain'),
@ejdanderson
ejdanderson / addToWaveRange
Last active January 3, 2016 20:29
IGOR Functions
// Add a value to a specific range of points of a wave
Function addToWaveRange(wname, startPoint, endPoint, addition)
wave wname
variable startPoint
variable endPoint
variable addition
variable ii
for ( ii=0; ii< (endPoint-startPoint); ii += 1 )
wname[startPoint + ii] += addition
@ejdanderson
ejdanderson / wp create term
Created August 26, 2014 15:55
Programatically create taxonomy terms
<?php
// Prevents duplicate term creation, useful when terms need to be programatically generated
function create_term( $slug, $name, $taxonomy ) {
$term_id = term_exists( $slug, $taxonomy );
if ( ! $term_id ) {
$term_data = wp_insert_term( $name, $taxonomy, array( 'slug' => $slug ) );
if ( $term_data && ! is_wp_error( $term_data ) ) {
$term_id = $term_data['term_id'];
}
}
@ejdanderson
ejdanderson / igor-colors
Last active August 29, 2015 14:05
Milarite Color Swap
ModifyGraph rgb(Bran2_Arm_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Bran4N_Dist_T)=(26112,52224,0),rgb(Darapi_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Dusmatovite_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Eifelite_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Kl_chite_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Merrihueite_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Mila25_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Mila29a_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Mila29b_Dist_T)=(26112,52224,0);DelayUpdate
ModifyGraph rgb(Mila30_Dist_T)=(26112,52224,0),rgb(Mila31_Dist_T)=(26112,52224,0);DelayUpdate
@ejdanderson
ejdanderson / anno-custom-header-size.php
Last active August 29, 2015 14:09
Annotum Custom Header Size
<?php
// Add the following function to a child theme or plugin:
// Class exists check in case adding to a plugin and themes are swapped.
if ( class_exists ( 'Anno_Keeper' ) ) {
function anno_custom_header_size() {
Anno_Keeper::keep( 'header_image', new Anno_Header_Image( 'header', array ( 1265, 110 ) ) );
}
// Priority 10 to come in after the annotum's initial template initialization.