Skip to content

Instantly share code, notes, and snippets.

@fblundun
fblundun / get-unused-imports.sh
Created April 20, 2016 14:14
Write list of filenames and line numbers corresponding to unnecessary import statements
for srcf in $(find src/main -name '*.scala'); do for lineno in $(grep -n '^import' $srcf | sed 's/:/ /g' | grep -v '{' | awk '{print $1}'); do echo $srcf $lineno; sed -i "${lineno}d" $srcf; sbt compile;if [ $? -eq 0 ]; then echo $srcf $lineno | tee -a output; fi; git checkout .; done; done
@fblundun
fblundun / using-badrows.md
Last active May 13, 2016 07:33
Bad Rows Documentation

This is a draft pending the release of Release 81

How to fix up and reprocess invalid events

Overview

When a raw event fails Scala Hadoop Enrich validation, it is written out to a bad rows bucket in a format which looks something like this:

{
@fblundun
fblundun / period_to_patterns.py
Created May 31, 2016 13:57
Period to patterns
#!/usr/bin/python
"""
Copyright (c) 2016 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
@fblundun
fblundun / script.html
Last active June 10, 2016 16:06
Support multiple enhanced ecommerce actions
<script>
// If this tag fires more than once (e.g. page view followed by ecommerce action),
// we don't want to repeat the trackPageView here
if (!window.SNOWPLOW_NAME_HERE) {
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.6.1/sp.js","SNOWPLOW_NAME_HERE"));
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>SalesDesk RestApi</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {