Skip to content

Instantly share code, notes, and snippets.

@qcom
qcom / output.txt
Created May 10, 2013 20:47
Output of Exporter.cs
1750-000-110 1700 Series Long Cases Pelican Pelican 1750-000-110 Watertight, crushproof and dustproof cases feature open-cell core, solid wall construction, O-ring seal and stainless steel hardware and padlock protectors. Automatic pressure equalization valve, polyurethane wheels with stainless steel bearings and fold-down handles unless otherwise specified. Lifetime guarantee of excellence. Black. Some cases are also available for personalized nameplate service. Call for details.
1700 Long case is a 3-piece foam set with interior dimensions: 35.75" x 13.50" x 5.25".
1720 Long case is a 3-piece foam set with interior dimensions: 42.00" x 13.50" x 5.25".
1750 Long case is a 3-piece foam set with interior dimensions: 50.50" x 13.50" x 5.25".
1770 Long case is a 4-piece foam set with (4) extra-deep, base-to-lid locking cleats for maximum stacking stability, (2) integrated automatic pressure equalization valves, (2) double-wide handles and (6) easy-open double throw latches. Interior dimensions: 54.58" x
@qcom
qcom / Exporter.cs
Last active December 17, 2015 05:19
class Program
{
static string connString = "Data Source=ZACH7-PC;Initial Catalog=Products;Integrated Security=True";
static string query = String.Empty;
static string header = "TemplateType=HomeImprovement Version=2012.0913 This row for Amazon.com use only. Do not modify or delete. Offer Information - These attributes are required to make your item buyable for customers on the site ";
static string schema = "sku,standard-product-id,product-id-type,product-name,brand,manufacturer,manufacturer-part-number,merchant-catalog-number,bullet-point1,bullet-point2,bullet-point3,bullet-point4,bullet-point5,description,product_type,item-price,currency,condition-type,condition-note,quantity,msrp,map,launch-date,release-date,leadtime-to-ship,restock-date,max-aggregate-ship-quantity,product-tax-code,warranty-type,seller-warranty-description,prop-65,cpsia-warning1,cpsia-warning2,cpsia-warning3,cpsia-warning4,cpsia-warning-description,sale-price,sale-start-date,sale-end-date,item-type,used-
@qcom
qcom / spects.txt
Last active December 15, 2015 15:59
Specs
My project is the development of a sort of support ticket system. So when an employee has a problem that needs action from another department or employee, a ticket is issued to the appropriate target.
The following is a quick overview of the entities that I'm having trouble modeling.
1. Tickets
Tickets are issues that need to be resolved, such as "Remove product X from our storefronts because it has been discontinued by the vendor." Tickets are constructed from one of a certain number of predefined "types" (can be thought of as "templates"). So, our above ticket example would have been created from the "Remove discontinued product" type. Another type might be "Increase sales price of product X", and so on. Basically, these types amount to just a collection of fields that need to be filled out by the instances of the templates. Tickets are composed of one or more tasks, as explained below. The tasks generated for each ticket depends on the kind of ticket it derives from.
2. Tasks
These are specific actions
@qcom
qcom / instructions.txt
Created February 7, 2013 00:04
CodeEval Problem (Easy)
Description:
Given a number n and two integers p1,p2 determine if the bits in position p1 and p2 are the same or not. Positions p1,p2 and 1 based.
Input sample:
The first argument will be a text file containing a comma separated list of 3 integers, one list per line. e.g.
86,2,3
125,1,2
@qcom
qcom / track.html
Created January 30, 2013 20:06
GoSquared Tracking Code
<script type="text/javascript">
var GoSquared = {};
GoSquared.acct = "GSN-848662-J";
(function(w){
function gs(){
w._gstc_lt = +new Date;
var d = document, g = d.createElement("script");
g.type = "text/javascript";
g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
var s = d.getElementsByTagName("script")[0];
@qcom
qcom / query.sql
Last active December 11, 2015 22:09
insert shipping weights into products table
-- 2 Tables: Products(SKU, ShippingWeight, Name, Description ...) and Weights(SKU, ShippingWeight)
select Products.SKU, Weights.ShippingWeight
from Products join Weights
on Products.SKU = Weights.SKU and Products.Vendor = 'MasterLock'
Version 1:
PRODUCTS
SKU | name |
01 |Hard Hat|
ATTRIBUTES
aID | name |
01 | color |
02 | closure|
@qcom
qcom / import.sql
Created January 23, 2013 18:17
import xml into sql table
use Products
go
-- create test table
create table XMLTest(SKU int, Description nvarchar(30))
go
-- edit
insert into XMLTest (SKU, Description)
select x.product.query('SKU').value('.', 'INT'),
I use excel to generate product upload files for Google's Merchant Center, Amazon's Seller Central, and in-house e-commerce solutions.
But it's the same type of data (i.e. products), and sometimes even the same data, just being pushed to different targets.
Maintaining these often half-duplicate xlsx files has become tedious and unwieldy, so I'm wondering if I should have a database of products that would allow me to generate a spreadsheet for each target (by performing certain queries on my more general data I'd assume).
Is this a legitimate time to use a database?
And, if so, should I use a relational database? I'm not too clear as to what kind of data is relational and what kind isn't, but I've read that traditionally relational databases are used in the corporate/e-commerce area.
But that could just be history rather than adeptness.
Anyway, just wondering.
@qcom
qcom / bookshelf.js
Created November 25, 2015 18:09
bookshelf initialization
var config = require('config');
var knex = require('knex')({
client: 'pg',
connection: config.get('postgresConnstring'),
debug: process.env.NODE_ENV === 'development'
});
var bookshelf = require('bookshelf')(knex);