Skip to content

Instantly share code, notes, and snippets.

Harold Kyle haroldkyle

Block or report user

Report or block haroldkyle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Gentle Lentil
# namespace gl
gl <- new.env()
# # of trials to run
gl$trials <- 20000
# profits (price minus costs) and their related probabilities
gl$entreeProfit <- c(9,7.5,5.5,4)
gl$entreeProbability <- c(0.25,0.35,0.3,0.1)
View DMDPS2.Rmd
---
title: 'DMD Problem Set #2'
author: "Harold Kyle"
output:
pdf_document:
fig_height: 7
fig_width: 8
toc: yes
---
View DMDPS2.R
# install.packages("ggplot2")
# install.packages("reshape")
# install.packages("gridextra")
require(ggplot2)
require(reshape)
library(gridextra)
### ASSUMPTIONS ###
View Woo Obj Cache Loop
[24-Sep-2014 03:41:09 UTC] PHP Fatal error: Maximum function nesting level of '200' reached, aborting! in /var/www/boxcar/trunk/wp-content/plugins/memcached/object-cache.php on line 272
[24-Sep-2014 03:41:09 UTC] PHP Stack trace:
[24-Sep-2014 03:41:09 UTC] PHP 1. {main}() /var/www/boxcar/trunk/wp-admin/post.php:0
[24-Sep-2014 03:41:09 UTC] PHP 2. edit_post() /var/www/boxcar/trunk/wp-admin/post.php:229
[24-Sep-2014 03:41:09 UTC] PHP 3. wp_update_post() /var/www/boxcar/trunk/wp-admin/includes/post.php:320
[24-Sep-2014 03:41:09 UTC] PHP 4. wp_insert_post() /var/www/boxcar/trunk/wp-includes/post.php:3577
[24-Sep-2014 03:41:09 UTC] PHP 5. do_action() /var/www/boxcar/trunk/wp-includes/post.php:3504
[24-Sep-2014 03:41:09 UTC] PHP 6. call_user_func_array() /var/www/boxcar/trunk/wp-includes/plugin.php:505
[24-Sep-2014 03:41:09 UTC] PHP 7. WC_Admin_Meta_Boxes->save_meta_boxes() /var/www/boxcar/trunk/wp-includes/plugin.php:505
[24-Sep-2014 03:41:09 UTC] PHP 8. do_action() /var/www/boxcar/trunk/wp-conten
@haroldkyle
haroldkyle / Remove countries from woocommece_params
Created Nov 29, 2013
Removes unnecessary countries (and their states) from the woocommerce_params that Woocommerce JSON encodes on every Wordpress page.
View Remove countries from woocommece_params
add_filter('woocommerce_states',function($countries){
// list the countries you actually want states for in this array
$countries_with_states = array( 'US','CA');
foreach($countries as $country=>$states){
if( !in_array($country, $countries_with_states) ){
unset( $countries[$country] );
}
}
@haroldkyle
haroldkyle / woocommerce-export-product-attributes-and-categories
Created May 7, 2013
This SQL script allows us to export woocommerce items (both single products and variable products) alongside their attributes and parent>child product categories. You can change values in the mapped parent categories ('Cards' or 'pa_attribute_cards' etc in my case) to suit your need. I wrote this to facilitate importing of woocommerce items into…
View woocommerce-export-product-attributes-and-categories
select distinct
# uncomment these rows for debugging
# p.ID,
# v.ID,
if( isnull(vm_sku.meta_value), pm_sku.meta_value, vm_sku.meta_value ) as 'sku',
p.post_title,
# need to cast prices to decimal because the datatype is not enforced otherwise
@haroldkyle
haroldkyle / https_posts_404.patch
Created Apr 23, 2013
Posts and custom post types do not work over SSL with the Custom Permalinks plugin for Wordpress. This patch uses home_url() instead of get_options('home') so that we respect the protocol for the custom permalink.
View https_posts_404.patch
Index: custom-permalinks.php
===================================================================
--- custom-permalinks.php (revision 2657)
+++ custom-permalinks.php (revision 2658)
@@ -41,7 +41,7 @@
function custom_permalinks_post_link($permalink, $post) {
$custom_permalink = get_post_meta( $post->ID, 'custom_permalink', true );
if ( $custom_permalink ) {
- return get_home_url()."/".$custom_permalink;
+ return home_url()."/".$custom_permalink;
You can’t perform that action at this time.