Skip to content

Instantly share code, notes, and snippets.

View alexanderdean's full-sized avatar

Alexander Dean alexanderdean

View GitHub Profile
@alexanderdean
alexanderdean / gist:1427099
Created December 3, 2011 13:17
For DictShield issue #45
#!/usr/bin/env python
from dictshield.document import Document, EmbeddedDocument
from dictshield.base import UUIDField, ShieldException
from dictshield.fields import (StringField,
DateTimeField,
IntField,
ListField,
FloatField,
EmbeddedDocumentField)
@alexanderdean
alexanderdean / gist:4001236
Created November 2, 2012 12:55
Intermittent error running SnowPlow clojure-collector via `lein ring server-headless`
╭─alex@nasqueron ~/Development/SnowPlow/snowplow/2-collectors/clojure-collector ‹feature/clj-collector›
╰─$ lein ring server-headless
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2012-11-02 12:53:35.833:INFO:oejs.Server:jetty-7.6.1.v20120215Started server on port 3000
2012-11-02 12:53:35.912:INFO:oejs.AbstractConnector:Started [email protected]:3000
^C% ╭─alex@nasqueron ~/Development/SnowPlow/snowplow/2-collectors/clojure-collector ‹feature/clj-collector›
╰─$ lein ring server-headless
@alexanderdean
alexanderdean / fetch_and_combine.py
Created November 15, 2012 08:31 — forked from larsyencken/fetch_and_combine.py
Aggregating CloudFront logs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# fetch_and_combine.py
#
"""
Scans CloudFront logs in an S3 bucket for any that are new. Combines log files
into a single local file per hour. If logs for multiple CloudFront
distributions are present, combines them all.
@alexanderdean
alexanderdean / gist:4205020
Created December 4, 2012 15:12
ICE table defn with fewer lookups & fatter fields
CREATE TABLE IF NOT EXISTS events_fewer_lookups (
-- App
`app_id` varchar(255) comment 'lookup', -- 'lookup' is a varchar optimisation for Infobright
`platform` varchar(50) comment 'lookup',
-- Date/time
`dt` date,
`tm` time,
-- Event
`event` varchar(255) comment 'lookup', -- Renamed in 0.0.3
`event_id` varchar(38), -- Added in 0.0.3

itemViewTrack

Details

Reference: snowplow/snowplow#113
Idea from: https://github.com/kingo55

Summary

This is a new feature to track views of products on ecommerce sites, or suggested articles on a media site, similar to how Google AdWords tracks ad views in different positions on a page.

/*
* Copyright (c) 2012 SnowPlow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@alexanderdean
alexanderdean / gist:4596562
Last active December 11, 2015 11:48
Excerpts for no-js-tracker.js
var encodeWrapper: windowAlias.encodeURIComponent;
/**
* A helper to build a SnowPlow request string from an
* an optional initial value plus a set of individual
* key-value pairs, provided using the add method.
*
* @param string initialValue The initial querystring, ready to have additional key-value pairs added
*
* @return object The request string builder, with add and build methods
// Alias. Worth keeping in because it's so verbose.
var encodeWrapper = window.encodeURIComponent;
// IMPORTANT!!
// ------------------------------------------
// This is how simple it is to build the final URL:
image.src = configCollectorUrl + '?' + request;
// See below for how each piece (configCollectorUrl and request) are built...
/**
@alexanderdean
alexanderdean / gist:5046364
Created February 27, 2013 08:42
Specs2 parallel test issues with Scalding 0.8.3
╭─alex@nasqueron ~/Development/SnowPlow/snowplow/3-etl/hadoop-etl ‹feature/scalding-etl›
╰─$ sbt
Detected sbt version 0.12.1
Starting sbt: invoke with -help for other options
[info] Loading global plugins from /home/alex/.sbt/plugins
[info] Loading project definition from /home/alex/Development/SnowPlow/snowplow/3-etl/hadoop-etl/project
[info] Set current project to snowplow-hadoop-etl (in build file:/home/alex/Development/SnowPlow/snowplow/3-etl/hadoop-etl/)
snowplow-hadoop-etl > test-only com.snowplowanalytics.snowplow.hadoop.etl.jobs.CorruptedCfLinesTest
13/02/27 08:40:20 INFO property.AppProps: using app.id: 83265FFB1D12AEF2BE02B7B711912163
13/02/27 08:40:20 INFO util.Version: Concurrent, Inc - Cascading 2.0.7