Skip to content

Instantly share code, notes, and snippets.

View UkParliamentPetitionDateMaths.js
/**
* A snippet of code I used to compare two petitions on the UK Parliament web site - wanting to know
* which grew fastest to challenge the claim "My Petition Is Bigger Than Yours".
* This input data is from the JSON download from the petition web site.
* A future version of this code could generalise its input to allow a petition to be selected for comparison.
*/
const data = {
"Revoke Article 50":{
"created_at": "2019-01-29T13:53:56.492Z",
@m0rjc
m0rjc / Promise.js
Last active Aug 29, 2015
My second attempt at Javascript Promises (aka Futures), in native Javascript
View Promise.js
/**
* Implementation of Javascript Promises.
* A simplified version of the U4.Promise framework I wrote for Unit4 in 2013.
* Building it up as I need it.
*/
var Promise = (function(){
/**
* @private
* Copy properties from one object to another.
* @param target
@m0rjc
m0rjc / gist:6317290
Last active Dec 21, 2015
Quick and dirty Perl script to deploy work in progress to Salesforce based on GIT status. This saves me a lot of time by allowing incremental compilation. Relies on my company's project layout which has two source roots - "source" and "systemtests". There is a directory called bin in which there is an ant script that provides access to the Sales…
View gist:6317290
#!/usr/bin/perl
#
# Deploy files I'm working on to Salesforce based on the GIT status.
#
# Assumptions:
# Two source roots - source and systemtests. These are normal Salesforce source roots with src/classes...
# bin/build.xml ant script with target dev.deploy called as
# ant dev.deploy -Dsf.deployRoot=<stagingdir>
#
@m0rjc
m0rjc / gist:73289d8084b2fcf1bbfa
Last active Dec 19, 2015
Code used trying to work out a cipher for Cyber Security Challenge
View gist:73289d8084b2fcf1bbfa
package m0rjc.test;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
/**
* Decode the hex string from a Cyber Security Challenge question.
* This code is enough to get the job done, rather than something neat.
*
* @author Richard Corfield <m0rjc@m0rjc.me.uk>