Skip to content

Instantly share code, notes, and snippets.

@jlav1n
jlav1n / ic6_db_schema_roundtable
Last active December 25, 2015 13:29
Interchange 6 / Nitesi Database Schema roundtable discussion - Ecommerce Innovation, Hancock, NY - Oct 10, 2013
Database Schema Roundtable
==========================
based on IC 5, many modifications, relational
products
--------
- weight from integer to decimal
- canonical_sku for variants to point to main product, because all
@jlav1n
jlav1n / jsloader
Created October 31, 2013 18:25
Javascript loader for asynchronous and non-blocking loading of JS. Compare this to https://github.com/ded/script.js
(function() {
function getScript(url,success){
var script=document.createElement('script');
script.src=url;
var head=document.getElementsByTagName('head')[0], done=false;
script.onload=script.onreadystatechange = function(){
if ( !done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') ) {
done=true;
success();
script.onload = script.onreadystatechange = null;
{
"vars": {},
"css": [
"buttons.less",
"close.less",
"modals.less"
],
"js": [
"modal.js"
]
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "#333",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 60%)",
"@gray-lighter": "#ccc",
"@brand-primary": "#ed9924",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
@jlav1n
jlav1n / httpd
Created August 5, 2015 22:35
/etc/logrotate.d/httpd
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
/var/log/httpd/*/logs/*log {
@jlav1n
jlav1n / fgciwrap
Last active November 14, 2015 21:43
# fcgiwrap launcher, /etc/init.d/fcgiwrap
# see: https://github.com/gnosek/fcgiwrap
# and https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/
# and: https://web.archive.org/web/20130324035657/http://nginx.localdomain.pl/wiki/FcgiWrap
# props: https://web.archive.org/web/20130322054803/http://www.tonimueller.org/blog/2012/09/hosting-interchange-on-nginx.html
#
#!/usr/bin/perl
use strict;
use warnings FATAL => qw( all );
@jlav1n
jlav1n / httpd.conf
Last active August 29, 2015 14:28
Interchange catalog at root URL. Prevents Interchange from having to handle all 404 requests, unless the request does not have an extension, or is a known file type that IC serves.
ScriptAlias /cgi-bin/ /home/mysite/cgi-bin/
RewriteEngine On
RewriteRule ^/index(\.html?)?$ / [R=301]
RewriteRule ^/?$ /cgi-bin/mysite/index [L,NS,PT]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f
RewriteRule ^ - [L,NS]
RewriteCond %{REQUEST_FILENAME} \.
<?php
/*
Plugin Name: Disable Pingbacks
Description: This plugin disables pingbacks.
Version: 1.0
Author: Josh Lavin
Author URI: http://www.endpoint.com
*/
add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['pingback.ping'] ); return $methods; } );
diff --git a/lib/Shipment/FedEx.pm b/lib/Shipment/FedEx.pm
index 67ca542..b15897e 100644
--- a/lib/Shipment/FedEx.pm
+++ b/lib/Shipment/FedEx.pm
@@ -262,6 +262,7 @@ sub _build_services {
PackageCount => $self->count_packages || 1,
PackageDetail => 'INDIVIDUAL_PACKAGES',
RequestedPackageLineItems => \@pieces,
+ RateRequestTypes => 'LIST',
},
#!/bin/env perl
use strict;
use warnings;
use JSON::MaybeXS qw(decode_json);
chomp( my $input = <STDIN> );
my $ref = decode_json( $input );