Skip to content

Instantly share code, notes, and snippets.

Avatar

Harry Cummings hgcummings

  • Softwire
  • London
View GitHub Profile
@hgcummings
hgcummings / yacave.p2y
Created Jul 24, 2016
My First Code: YA Cave
View yacave.p2y
'All code (c) Harry Cummings 2002
'Original concept (c) SunFlat
'For additional information and instructions,
'see readme.txt. For the latest version, see
'http://yabasic.electricweb.org.uk/
open window 640,512
draw = 1
p = 0
@hgcummings
hgcummings / README.md
Last active Apr 7, 2016
JIRA bullets bookmarklet
View README.md

Bookmarklet for turning bullet lists pasted in from MS Office into JIRA/Confluence markup bullet points.

Currently supports unordered lists up to two levels deep.

javascript:var elem = jQuery(':focus'); elem.val(elem.val().replace(/•\t/g, '* ').replace(/o\t/g, '** '));

@hgcummings
hgcummings / app.js
Created Feb 13, 2016
Repro case for istanbul issue
View app.js
module.exports = (a, b) => {
'use strict';
let result = a + b;
if (result > 0) {
console.log('Covered branch');
return true;
} else {
console.log('Uncovered branch');
return false;
}
@hgcummings
hgcummings / holidays.js
Last active Jan 1, 2016
Script to insert 2016 UK bank holidays into a MongoDB database
View holidays.js
db.holidays.insert({ name: "New Year's Day", date: ISODate("2016-01-01") });
db.holidays.insert({ name: "Good Friday", date: ISODate("2016-03-25") });
db.holidays.insert({ name: "Easter Monday", date: ISODate("2016-03-28") });
db.holidays.insert({ name: "Early May bank holiday", date: ISODate("2016-05-02") });
db.holidays.insert({ name: "Spring bank holiday", date: ISODate("2016-05-30") });
db.holidays.insert({ name: "Summer bank holiday", date: ISODate("2016-08-29") });
db.holidays.insert({ name: "Boxing Day", date: ISODate("2016-12-26") });
db.holidays.insert({ name: "Christmas Day", date: ISODate("2016-12-27"), substitute_for: ISODate("2016-12-25") });
db.holidays.aggregate([{ $project: { name: true, original_date: { $ifNull: ["$substitute_for", "$date"] } } }, { $sort: { original_date: 1} }])
@hgcummings
hgcummings / generators.js
Last active Aug 29, 2015
Promises and generators demo
View generators.js
// Run with node --harmony_generators generators.js
function* generator() {
var received = yield 1;
console.log(received);
return 3;
}
var instance = generator();
var first = instance.next();
console.log(first);
@hgcummings
hgcummings / results.html
Last active Aug 29, 2015
hypermeter graphs with Chart.js
View results.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.1/Chart.min.js"></script>
<style>
body {
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
}
#legend li {
list-style-type: none;
@hgcummings
hgcummings / s3_caching.sh
Created Aug 25, 2014
Script for caching and retrieving build dependencies to/from S3 - usage instructions at http://hgc.io/2014/08/26/Caching-Travis-CI-dependencies-in-S3/#The_solution
View s3_caching.sh
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) 2014 Harry Cummings
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
You can’t perform that action at this time.