Skip to content

Instantly share code, notes, and snippets.

View chrisroos's full-sized avatar

Chris Roos chrisroos

View GitHub Profile
@chrisroos
chrisroos / hsbc-friendly-account-names.user.js
Created February 7, 2014 13:00
A simple Greasemonkey style user script to replace account numbers with friendly names in the HSBC business banking user interface
// ==UserScript==
// @name HSBC - Friendly account names
// @namespace http://chrisroos.co.uk/
// @description Replace account numbers with friendly names to help differentiate accounts in HSBC UK Business banking
// @include https://www.business.hsbc.co.uk/*
// ==/UserScript==
(function() {
var accounts = {
'12345678': 'Current account',
@chrisroos
chrisroos / README.md
Last active August 29, 2015 13:57
JavaScript utility to list the pages with most activity on the indiewebcamp.com wiki

I've created this to make it easier to see the pages with most activity on indiewebcamp.com.

It's designed to be used on the recent changes page of the wiki, e.g. http://indiewebcamp.com/wiki/index.php?title=Special:RecentChanges&limit=250&days=14.

Paste this script into Chrome's JavaScript console (it might work in other browsers but I haven't tested it) and inspect the output there.

The easiest way to exclude some dates is to remove the ul for that date using the Chrome developer tools.

@chrisroos
chrisroos / README.md
Last active August 29, 2015 14:00
Example of the "not supported" error message problem in video.js

In Chrome 34.0.1847.116 on Mac OS X 10.9.2, this configuration (specifically the lack of type="video/mp4" on the source element) of video.js causes the notSupportedMessage error message to be dislayed by the video.js player. Although I can see the error message has been added to the DOM, it's not visible and it causes the vjs-poster element to be pushed down the page, resulting in one copy of the poster image overlaying the other.

I've raised this as issue 1164 in the video.js repo.

@chrisroos
chrisroos / README.md
Last active August 29, 2015 14:00
Testing the video.js error messages plugin

This is a test of the video.js errors plugin. I'm not sure it's quite working reliably enough for us to use it. I got it to display an error in Chrome by faking a 504 response from the video source, but that error wasn't shown in Safari or Firefox. Firefox tells me that the source couldn't be loaded in the developer console but Safari just shows the spinning loader and nothing in the developer tools that I can see.

NOTE I had to explicitly reference the plugin in the data-setup attribute as per issue 5 on the original videojs-errors repo.

@chrisroos
chrisroos / README.md
Created October 3, 2014 11:14
Parse CloudStore results and display as markdown

About

Parse a CloudStore search results page and display the results as markdown.

NOTE. It only displays the first page of search results

Usage example

$ curl -s "http://govstore.service.gov.uk/cloudstore/search/?q=software+development" | \

ruby cloudstore-results-parser.rb

@chrisroos
chrisroos / honeybadger-helper.js
Last active August 29, 2015 14:09
Functions that help when dealing with large numbers of exceptions in Honeybadger
// Mark all Honeybadger exceptions as resolved if
// they don't have any error text
// This suggests they are Cloudflare errors in the
// current project
$('td.error').each(function() {
var overview = $('.overview', $(this));
if (overview.text().trim() == '') {
var toggleButton = $('input[name="fault[resolved]"]', $(this).parent());
toggleButton.click();

Investigation into Rails routing

I wanted to understand how combinations of resources :format and resources :constraints affected the HTTP response codes from Rails.

I created a new Rails 4.1.8 app and used scaffolding (rails g scaffold people name:string) to create a very simple app.

I started the Rails server and created a single person (with ID 1).

I updated the Routes and recorded the results of a request to GET the Person using cURL.

@chrisroos
chrisroos / README.md
Last active August 29, 2015 14:17
Installing aisdecoder on Ubuntu in VirtualBox
@chrisroos
chrisroos / README.md
Last active August 29, 2015 14:19
The problem I had when installing gems under Ruby 2.1.5

I'm getting this error when installing eventmachine in one project, and therubyracer in another.

I tried re-installing Command Line Tools for XCode 6.3 but that didn't work.

I tried re-installing Ruby 2.1.5 but that didn't work.

Having re-read "Missing c++ header <__debug> after updating OSX Command Line Tools 6.3" I noticed that it said to reinstall the Command Line Tools for XCode 6.2. I've now done that and can successfully compile eventmachine and therubyracer gems.

Another Stack Overflow post, "Unable to install therubyracer on clean install of Yosemite and clean version of ruby", talks about the same problem but doesn't have an answer listed.

@chrisroos
chrisroos / test-output.txt
Created April 29, 2015 13:11
The tests that fail in smart-answers when I run with seed 56021
Chriss-MacBook-Air-2:~/Code/alphagov/smart-answers$ rake test TESTOPTS="--seed=56021"
* DEFERRED: sequence of two questions a question raises an error should permit custom error messages per question.
Run options: --seed=56021
# Running:
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................