Skip to content

Instantly share code, notes, and snippets.

View commuterjoy's full-sized avatar

Matt Chadburn commuterjoy

View GitHub Profile
@commuterjoy
commuterjoy / body
Created May 29, 2013 14:23
Generate a report via the SiteCatalyst / Omniture API via Ruby & CURL
{
"reportDescription":{
"reportSuiteID":"<report-suite-id>",
"date":"2013-05-11",
"dateFrom":"",
"dateTo":"",
"dateGranularity":"hour",
"metrics":[
{
"id":"event37"
require 'socket'
class Graphite
attr_accessor :key
def initialize(opts)
@host = opts[:host]
@port = opts[:port] || 2003
end
GDN-1249 - Badges/sponsorship not showing in Australia - MAY - ***
GDN-1241 - Cinema listings not updating - MAY - **
GDN-1238 - <title> is too far down the source for Live Blogs - MAY - ***
GDN-1237 - Guardian.co.uk not displaying correctly in IE8 - MAY - *
GDN-1231 - US pressed page is TWO MONTHS out of date - APR - ***
GDN-396 - 500 or "Guru Meditation Error" - APR - *** change
GDN-784 - Going to gu.com/australia sets edition to AU - APR - * change
GDN-822 - guardian.co.uk/rss - top stories rss feed is out of date - APR - *** feedburner change
GDN-930 - Business front and US CIF front content API failing - APR - *
GDN-561 - R2 Responsive football page - Fixtures dropdown at top of page overlaps promo column - MAR - * change
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25"
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25"
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25"
"Mozilla/5.0 (iPod; CPU iPhone OS 6_1_2 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B146 Safari/8536.25"
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25"
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25"
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_2 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A551 Safari/8536.25"
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) App
GET /politics/2013/aug/29/welfare-reforms-scottish-independence HTTP/1.1,200
GET /commentisfree/2013/jul/10/antitrust-apple-plot-publishers-ebook HTTP/1.1,200
GET /teacher-network/teacher-blog/2013/sep/01/science-teacher-us-education HTTP/1.1,200
GET /p/3tft2/tw HTTP/1.1,200
GET /small-business-network/2013/aug/29/social-media-boost-business-tips HTTP/1.1,200
GET /world/2012/aug/17/iraq-holiday-bombs-kill-93 HTTP/1.1,200
GET /environment/2013/sep/04/company-fracking-protests-drilling-licences HTTP/1.1,200
GET /commentisfree/2012/may/21/control-food-resources-supermarket HTTP/1.1,200
GET /media-network/media-network-blog/video/2013/mar/11/marketing-campaigns-optimisation-personalisation-video HTTP/1.1,200
GET /media-network/media-network-blog/video/2013/mar/11/marketing-campaigns-optimisation-personalisation-video HTTP/1.1,200
require 'rubygems'
require 'trollop'
require 'json'
require 'cgi'
require 'rest_client'
require 'time'
CONF = Trollop::options do
opt :since, "Seconds elapsed between now and the publication date", :type => :int, :required => true, :short => "-s"
@commuterjoy
commuterjoy / gist:7499443
Created November 16, 2013 12:06
Using vim to edit multiple files

First we want to open a bunch of files based on some pattern,

vim $(grep -Rl 'commentCount' *)

Then we want to a find & replace across all buffers,

bufdo %s/commentCount/comment-count/ | update
@commuterjoy
commuterjoy / output
Last active December 28, 2015 18:58
Simon Jenkins
set search_path to public,vlad;
-- join pageviews to content api via path
with content_ids as
(
select
id
from
content_dim
where
# grep -Ri 'm.d.viewability.Viewability' * | cut -d ':' -f 2- | cut -d ' ' -f 1,2,8- > raw
# ruby formatter < raw > advert-data-raw
# sort advert-data-raw > advert-data-raw.sorted
STDIN.read.split("\n").each { |a|
b = a.split(",")
date = b.shift
data = b.slice(0,b.length).map { |f|
c = f.split("->")[1]
c.gsub!(/Some\(([\d+])\)/, '\1')