This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "twitter" | |
require "curb" | |
require "pp" | |
require "json" | |
require "opengraph_parser" | |
puts "Authenticating..." | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = "foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert an HSBC "previous statement" page into a CSV | |
var year = 2013, | |
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
var output = '', | |
rows = $('table').last().find('tr'); | |
rows.each(function(i, row) { | |
if(i === 1 || i === rows.length - 1) return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
x=`identify -format "%w" $1` | |
y=`identify -format "%h" $1` | |
data=`openssl base64 < $1 | tr -d '\n'` | |
type=`file --mime-type -b $1` | |
echo "display:block; | |
font:0/0 a; | |
color:transparent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure we have MIME types set up for WOFF, EOT and TT fonts. | |
# Existing mappings for these extensions are overridden. | |
AddType application/font-woff .woff # http://www.w3.org/TR/WOFF | |
AddType application/x-font-ttf .ttf # No standard type for TT | |
AddType application/vnd.ms-fontobject .eot # iana.org/assignments/media-types/application | |
# Ensure the JS MIME type is set to what we expect. | |
AddType application/javascript .js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dictionary | |
def initialize | |
@words = read_source | |
end | |
def include? word | |
self.words.include? word | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
require 'dictionary' | |
require 'suggester' | |
dict = Dictionary.new | |
loop do | |
print '> ' | |
word = gets |
NewerOlder