Skip to content

Instantly share code, notes, and snippets.

CountCulture

Block or report user

Report or block CountCulture

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ons_reader.rb
class OnsReader
require 'httpclient'
BaseUrl = "http://neighbourhood.statistics.gov.uk/dissemination/"
def self.process
sets = YAML.load_file(File.join(RAILS_ROOT, "db/ons_data", "current_datasets.yml"))[0..100]
client = HTTPClient.new
sets.each do |set|
url = set[:url]
View ons_dataset_finder.rb
class OnsDatasetFinder
require 'httpclient'
BaseUrl = "http://neighbourhood.statistics.gov.uk/dissemination/"
def self.process
all_datasets = []
home_page = "http://neighbourhood.statistics.gov.uk/dissemination/Download1.do"
parsed_page = get_page(home_page)
dataset_group_paths = parsed_page.search('#mainContent3 li a[@href*="datasetList.do"]').collect {|ds| ds[:href]}.uniq
View gist:280081
# Based on http://gist.github.com/258730 and on http://www.nearby.org.uk/tests/GeoTools.html. Not yet working properly
module OsCoordsUtilities
E2 = 0.0066705397616 # OSI eccentricity squared
A = 6377563.396 # OSI semi-major
B = 6356256.910 # OSI semi-minor
extend self
def convert_os_to_wgs84(eastings, northings, height=0)
View gist:280083
# Based on http://gist.github.com/258730 and on http://www.nearby.org.uk/tests/GeoTools.html. Not yet working properly
module OsCoordsUtilities
E2 = 0.0066705397616 # OSI eccentricity squared
A = 6377563.396 # OSI semi-major
B = 6356256.910 # OSI semi-minor
extend self
def convert_os_to_wgs84(eastings, northings, height=0)
View gist:318267
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Council location | Lichfield District Council</title>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/standard.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/style.php" media="screen" />
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special_print.css" media="print" />
View gist:320608
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Council location | Lichfield District Council</title>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/standard.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/style.php" media="screen" />
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special_print.css" media="print" />
View gist:321520
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Council location | Lichfield District Council</title>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/standard.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/style.php" media="screen" />
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special_print.css" media="print" />
View gist:321521
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Council location | Lichfield District Council</title>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/standard.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/style.php" media="screen" />
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/generic/ie_special_print.css" media="print" />
View gist:333217
<!-- This is an example of the key content on a typical page containing links to election results pages, marked up appropriately to -->
<!-- expose the informationas data rather than just text -->
<!-- ####### -->
<!-- ####### -->
<!-- ####### -->
<!-- We are using the <div> which wraps the content to declare the 'namespaces' for various attributes we use to give the links meaning -->
<!-- e.g. we say that when we're talking about foaf things (e.g. foaf:isPrimaryTopicOf) we mean things defined at "http://xmlns.com/foaf/0.1/" -->
<div id="content" xmlns:openelection="http://openelectiondata.org/0.1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
View gist:333272
<!-- This is an example of the key content on a typical page containing links to ward results pages, marked up appropriately to -->
<!-- expose the information as data rather than just text -->
<!-- ####### -->
<!-- ####### -->
<!-- ####### -->
<!-- We are using the <div> which wraps the content to declare the 'namespaces' for various attributes we use to give the links meaning -->
<!-- e.g. we say that when we're talking about foaf things (e.g. foaf:isPrimaryTopicOf) we mean things defined at "http://xmlns.com/foaf/0.1/" -->
<div id="mainContent" xmlns:openelection="http://openelectiondata.org/0.1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
You can’t perform that action at this time.