Skip to content

Instantly share code, notes, and snippets.

View cantlin's full-sized avatar

Cantlin Ashrowan cantlin

View GitHub Profile
@cantlin
cantlin / hacked_bookmarklet
Created July 20, 2013 15:02
opens a guardian url in the api
javascript:var u='content.guardianapis.com';window.open((window.location.toString().split('#')[0].split('?')[0] + '.json?api-key=hackedio&show-fields=all&show-tags=all&show-media=all').replace('www.guardian.co.uk', u).replace('m.guardian.co.uk', u));
#! /usr/bin/env ruby
require "json"
infile = "antarctica_hits"
lines = File.readlines infile
parsed_lines = lines.map do |line|
line = line.gsub(/2014-02-28T12-ip-10.*\.internal:/, "")
JSON.parse(line) rescue next
require 'curb'
require 'json'
require 'sinatra'
last_poll = Time.now
poll_interval = 10
borked_videos = []
EXPECT_ENCODINGS = ['video/mp4','video/3gp:small','video/3gp:large','video/m3u8','video/webm']
Thread.abort_on_exception = true
define(['angular', 'lodash'], function(angular, _) {
'use strict';
var mod = angular.module('guardianCardServices', []);
// Matches on any Guardian content URL
// Higher priority services (e.g. video embed) should be tried first
var guCardUriPattern = /https?:\/\/www\.theguardian\.com\/.*\/\d{4}\/.*/;
// var guCardEmbedApiHost = "http://embed.theguardian.com/oembed/"
require "twitter"
require "curb"
require "pp"
require "json"
require "opengraph_parser"
puts "Authenticating..."
client = Twitter::REST::Client.new do |config|
config.consumer_key = "foo"