Skip to content

Instantly share code, notes, and snippets.

View timmyc's full-sized avatar

Timmy Crawford timmyc

View GitHub Profile
@timmyc
timmyc / gist:1568641
Created January 6, 2012 02:28
unique venues
shows = [{venue_id : 1, venue : 'The Showbox', date : '', acts : 'Pearl Jam,Soundgarden', featured : false, lat : '', long : ''},{venue_id : 2, venue : 'The Croc', date : '', acts : 'Sweeetwater', featured : false, lat : '', long : ''},{venue_id : 3, venue : 'Paramount', date : '', acts : 'Alice in Chains', featured : false, lat : '', long : ''},{venue_id : 1, venue : 'The Showbox', date : '', acts : 'Blue Scholars', featured : false, lat : '', long : ''}];
venues = {};
_.each(shows, function(o){ venues[o.venue_id] = o });
unique_venues = _.values(venues);
//
// Sparrow+SI.h
//
#import <UIKit/UIKit.h>
@interface SPUtils (DeviceAdditions)
+ (BOOL)isDevicePad;
+ (BOOL)isDeviceRetina;
@end
@timmyc
timmyc / twilio_calls_controller.rb
Created February 9, 2012 21:05
Twilio Request Validation for Rails
class TwilioCallsController < ApplicationController
before_filter :authenticate_twilio_request, :only => [
:twilio_handling_method_1, :twilio_handling_method_2
]
def twilio_handling_method_1
# do something Twilio-related
end
def twilio_handling_method_2
@timmyc
timmyc / clicky_stats_pie_chart.js
Created September 13, 2012 16:30
Highcharts + Clicky Mashup
$("#clicky-chart").click(function(){
var sd = '<%= @sd.to_date %>';
var ed = '<%= @ed.to_date %>';
$(this).hide();
$.getJSON('http://api.getclicky.com/api/stats/4?site_id=<%= @store.clicky %>&sitekey=<%= @store.clicky_key %>&type=traffic-sources&date=' + sd + ',' + ed + '&output=json&json_callback=?',function(data){
var sources = data[0].dates[0].items;
var series_data = [];
for(var i=0; i<sources.length; i++){
var source = sources[i];
series_data.push({
@timmyc
timmyc / order_decorator.rb
Created April 14, 2013 16:58
/app/decorators/models/piggybak/order_decorator.rb
Piggybak::Order.class_eval do
has_many :packages
end

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

diff --git a/includes/api/class-wc-rest-reports-revenue-stats-controller.php b/includes/api/class-wc-rest-reports-revenue-stats-controller.php
index 7dbbe00..8c289e3 100644
--- a/includes/api/class-wc-rest-reports-revenue-stats-controller.php
+++ b/includes/api/class-wc-rest-reports-revenue-stats-controller.php
@@ -62,22 +62,26 @@ class WC_REST_Reports_Revenue_Stats_Controller extends WC_REST_Reports_Controlle
$reports_revenue = new WC_Reports_Revenue_Query( $query_args );
$report_data = $reports_revenue->get_data();
+ $totals = $report_data ? $report_data->totals : array();
+ $intervals = $report_data ? $report_data->intervals : array();
Index: printful-shipping.php
===================================================================
--- printful-shipping.php (revision 2054638)
+++ printful-shipping.php (working copy)
@@ -63,7 +63,6 @@
require_once 'includes/class-printful-admin-support.php';
require_once 'includes/class-printful-size-chart-tab.php';
require_once 'includes/class-printful-size-chart-tab.php';
- require_once 'includes/class-printful-rest-api-controller.php';
@timmyc
timmyc / disable-jetpack-woocommerce-analytics.php
Created July 24, 2019 23:52
remove WooCommerce Analytics from Jetpack
<?php
/**
* @package Disable_Jetpack_WooCommerce_Analytics
* @version 1.0.0
*/
/*
Plugin Name: Disable Jetpack WooCommerce Analytics
Plugin URI: https://github.com/Automattic/jetpack
Description: This plugin disables the Jetpack WooCommerce Analytics module
Version: 1.0.0
@timmyc
timmyc / gist:ba87390aba75b89181193bc55ed0ef9d
Created January 28, 2020 18:51
tweaks to induce the retryAuth code path
diff --git a/client/jetpack-connect/authorize.js b/client/jetpack-connect/authorize.js
index 0cbcb1bf79..ec193679bc 100644
--- a/client/jetpack-connect/authorize.js
+++ b/client/jetpack-connect/authorize.js
@@ -726,7 +726,7 @@ const connectComponent = connect(
const isMobileAppFlow = !! mobileAppRedirect;
return {
- authAttempts: getAuthAttempts( state, urlToSlug( authQuery.site ) ),
+ authAttempts: 1,