Skip to content

Instantly share code, notes, and snippets.

@chrislo
chrislo / 2018-11-07-map-with-highlightable-regions-resources.md
Last active November 7, 2018 16:20
Resources for building a map with highlightable regions

At DataKind on 7th November 2018 I am speaking to a charity who would like to build a map tool that works in a similar way to the one on http://www.domesticabusemigration.co.uk/.

That site includes the code for the map. The code helpfully links to the following resources which helped the developer to make it:

@chrislo
chrislo / keybase.md
Created March 17, 2014 17:30
keybase.md

Keybase proof

I hereby claim:

  • I am chrislo on github.
  • I am chrislowis (https://keybase.io/chrislowis) on keybase.
  • I have a public key whose fingerprint is 4E0B 406F 3E2F 5ACC E0CA F0C2 B9B8 2371 498D 0E0A

To claim this, I am signing this object:

@chrislo
chrislo / govuk-development-vm.md
Created February 28, 2018 15:46 — forked from floehopper/govuk-development-vm.md
Setup GOV.UK development VM with local SSO, Whitehall & its draft stack

Data replication

The idea here is to load the routes for the router and draft-router. Life's too short to work out how to create the routes manually!

  • cd /var/govuk/govuk-puppet/development-vm/replication
  • Apply replicate-data-local.diff patch to skip all dbs on mongo-1.backend & api-mongo-1.api
  • Run the following command to import data for router & draft-router: ./replicate-data-local.sh -s -d backups/YYYY-MM-DD -p -q -e -t -i 'collections_publisher contacts release search_admin tariff_admin tariff_temporal'

Authenticating proxy

@chrislo
chrislo / gist:5717561
Last active June 17, 2016 09:43
Code for the Web Audi "monosynth" from my blog post (http://blog.chrislowis.co.uk/2013/06/05/playing-notes-web-audio-api.html)
$(function () {
var keyboard = qwertyHancock({id: 'keyboard'});
var context = new AudioContext();
/* VCO */
var vco = context.createOscillator();
vco.type = vco.SINE;
vco.frequency.value = this.frequency;
vco.start(0);
require 'minitest/unit'
require 'minitest/autorun'
class Atom
attr_reader :symbol
def initialize(symbol)
@symbol = symbol
end
@chrislo
chrislo / libby_bot
Created September 5, 2013 15:31
RTanque bot
class LibbyBot < RTanque::Bot::Brain
NAME = 'libby_bot'
include RTanque::Bot::BrainHelper
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 1.0
def tick!
self.move_randomly
if (target = self.nearest_target)
@chrislo
chrislo / gist:982716
Created May 20, 2011 10:54
Accessing a variable inside a nokogiri template
require 'sinatra'
require 'nokogiri'
get '/' do
@thing = 'thing'
nokogiri :index
end
__END__
require 'rubygems'
require 'sinatra'
require 'omniauth'
require 'pp'
use OmniAuth::Builder do
provider :twitter, '<key>', '<secret>'
end
enable :sessions
PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>
PREFIX po: <http://purl.org/ontology/po/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?episode ?broadcast_start ?broadcast_end
WHERE
{ ?episode po:version ?version .
?broadcast po:broadcast_of ?version .
?broadcast event:time ?time .
?time tl:start ?broadcast_start .
module Cucumber
module Formatter
class Html
def initialize
end
def after_features
puts "original after_features"
end
end
end