Skip to content

Instantly share code, notes, and snippets.

View heathd's full-sized avatar

David Heath heathd

View GitHub Profile
@heathd
heathd / clean_encoding.rb
Created October 31, 2012 08:14
Character Encoding Cleaner
#!/usr/bin/env ruby -w
require 'pp'
require 'set'
require 'colorize'
require 'forwardable'
unless ARGV.size >= 1
puts "Usage: __FILE__ <input file> [<output file>]"
exit(1)
end
@heathd
heathd / double-encodings.rb
Created December 11, 2012 14:57
All possible double-encodings of Windows-1252
class CodePoint
def initialize(b)
@b = b
end
def hex
@b.to_s(16)
end
def char_windows
@heathd
heathd / testtimes.csv
Last active December 12, 2015 03:38
Whitehall test times
Test file Total time (secs) Num tests
Admin::PublicationsControllerTest 64.40897911399999 179
Admin::ConsultationsControllerTest 53.54554799800004 192
Admin::PoliciesControllerTest 51.64296816499997 133
Admin::SpeechesControllerTest 49.026733437999994 125
Admin::DetailedGuidesControllerTest 47.214723524 161
Admin::NewsArticlesControllerTest 44.89375400000001 133
Admin::StatisticalDataSetsControllerTest 34.746459009000006 129
Admin::FatalityNoticesControllerTest 33.682851786000015 118
Admin::CaseStudiesControllerTest 26.38523314900001 99
@heathd
heathd / example.erb
Last active December 14, 2015 07:08
Hello <%= name %>!
@heathd
heathd / ago-extras.csv
Last active December 15, 2015 22:50
test mappings
Old Url New Url Status
http://www.ago.gov.uk/aboutus/pages/thing https://www.gov.uk/government/organisations/attorney-generals-office/thing 301
@heathd
heathd / Gemfile
Last active August 29, 2015 14:02
Ruby2Ruby destroys its input
source 'http://rubygems.org'
gem 'ruby2ruby'
gem 'rspec'
@heathd
heathd / stanford-nlp-test.rb
Created January 6, 2015 17:10
stanford-nlp-test.rb
require 'stanford-core-nlp'
# Set an alternative path to look for the JAR files
# Default is gem's bin folder.
StanfordCoreNLP.jar_path = File.realpath(File.dirname(__FILE__)) + '/jars/'
StanfordCoreNLP.model_path = File.realpath(File.dirname(__FILE__)) + '/jars/'
StanfordCoreNLP.use :english
StanfordCoreNLP.model_files = {}
StanfordCoreNLP.default_jars = [
'jollyday.jar',
@heathd
heathd / psql.go
Created January 16, 2015 15:48
psql connection example
package main
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
"log"
)
func main() {
@heathd
heathd / schema.rb
Created February 5, 2015 23:34
Attempt to reproduce globalize issue (PR#330)
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
create_table :products, :force => true do |t|
t.timestamps
end
create_table :product_translations, :force => true do |t|
t.string :locale
t.references :product
@heathd
heathd / config
Last active August 29, 2015 14:16 — forked from issyl0/config
[
{
"userName": "alphagov",
"repo": "asset-manager"
},
{
"userName": "alphagov",
"repo": "authenticating-proxy"
},
{