Skip to content

Instantly share code, notes, and snippets.

View scottdriscoll's full-sized avatar

Scott Driscoll scottdriscoll

View GitHub Profile
@scottdriscoll
scottdriscoll / booklets_downgrade.sql
Created February 28, 2013 01:07
Booklets - wiping schema and all data to start fresh
-- SQL Script to remove all booklet entries and schema.
-- item.type range is 251 - 280
-- revrec sku cat ids are 92 - 121
-- Product types are 'booklets-85x11' and 'booklets-55x85'
BEGIN;
-- Delete Booklet entries from migration_log
DELETE FROM migration_log WHERE patch_file IN (
'option.sql',
-- SQL Script to remove all booklet entries and schema.
-- item.type range is 251 - 280
-- revrec sku cat ids are 92 - 121
-- Product types are 'booklets-85x11' and 'booklets-55x85'
BEGIN;
-- Delete Booklet entries from migration_log
DELETE FROM migration_log WHERE patch_file IN (
'option.sql',
-- SQL Script to remove all booklet entries and schema.
-- item.type range is 251 - 280
-- revrec sku cat ids are 92 - 121
-- Product types are 'booklets-85x11' and 'booklets-55x85'
BEGIN;
-- Delete Booklet entries from migration_log
DELETE FROM migration_log WHERE patch_file IN (
'option.sql',
@scottdriscoll
scottdriscoll / list.c
Created March 15, 2013 03:51
simple doubly linked list in ansi c
#include <stdio.h>
#include <stdlib.h>
struct node {
int num;
struct node *next;
struct node *prev;
};
struct node *create(int num)
@scottdriscoll
scottdriscoll / php.ini
Created March 21, 2013 16:27
php.ini session section
[Session]
; Handler used to store/retrieve data.
; http://php.net/session.save-handler
session.save_handler = files
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; The path can be defined as:
@scottdriscoll
scottdriscoll / search.sql
Created March 27, 2013 23:10
slow query...
explain analyze SELECT
count(1) AS count
FROM
merlin.merlin_templates t
INNER JOIN merlin.merlin_keywords k ON t.id = k.merlin_template_id
WHERE
t.enabledstatus = 1
AND t.disabled = 0
AND k.keyword @@ to_tsquery('red|blue')
AND product_id = 1
// ==UserScript==
// @name Adds Metadata on Github Pull Request
// @namespace http://github.com/richardfullmer
// @include https://github.com/*/*/pulls*
// @version 3
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// ==/UserScript==
$(function() {
var access_token = "your_token";
$(".pulls-list .list-group-item h4").each(function() {
@scottdriscoll
scottdriscoll / fncptr.cpp
Created July 13, 2014 01:46
c++ function pointers
#include <iostream>
class BaseClass
{
protected:
std::string id;
public:
BaseClass(std::string id)
{
@scottdriscoll
scottdriscoll / udp_test
Created September 19, 2014 04:55
upd tests
#include "stdafx.h"
#include <winsock2.h>
int _tmain(int argc, _TCHAR* argv[])
{
WSADATA wsaData = { 0 };
char ip[64];
char message[256];
char readMessage[256];
int port = 12121;
@scottdriscoll
scottdriscoll / missing_folding.sql
Created March 18, 2015 23:53
missing folding type
select distinct on (rr.order_id) rr.order_id, cat.title from rr_sku_cat cat
inner join rr_transactions rr on rr.sku_cat_id = cat.id
where rr.order_id in (
select id from (
select o.id,
(select count(v.id) from order_item_option_value v inner join order_items oi on v.order_item_id = oi.id where oi.order_id = o.id and v.option_value_id in (103,106)) as folding_option_count,
(select count(v2.id) from order_item_option_value v2 inner join order_items oi2 on v2.order_item_id = oi2.id where oi2.order_id = o.id and v2.option_value_id in (10,11,12)) as folding_count
from orders o
inner join order_items oi3 on o.id = oi3.order_id
where o.payment_status = 1 and