Skip to content

Instantly share code, notes, and snippets.

@zpaav
zpaav / gist:9e003e9b97665769b4ee
Created October 16, 2015 18:04 — forked from bhurlow/gist:3861616
Better XML to JSON parsing for cdata
// Changes XML to JSON
// fixed some bugs from http://davidwalsh.name/convert-xml-json
// October 9, 2012
// Brian Hurlow
function xmlToJson(xml) {
// Create the return object
var obj = {};
// console.log(xml.nodeType, xml.nodeName );
@zpaav
zpaav / PinDistrictApps.cmd
Created February 12, 2016 20:38 — forked from sirlancelot/PinDistrictApps.cmd
Windows 7 script to pin items to the taskbar. Can be placed in the default user's startup folder. Self-terminating.
@echo off
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Mozilla Firefox\Mozilla Firefox.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Word 2007.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2007.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office PowerPoint 2007.lnk"
@zpaav
zpaav / couchdb-importer.js
Created June 30, 2016 21:40 — forked from tbranyen/couchdb-importer.js
Miso Project - Dataset: CouchDB Importer
// Underscore utility
var _ = require("underscore");
// Miso library
var Miso = require("miso.dataset");
// Nano library
var nano = require("nano");
/*
* The Couchdb importer is responsible for fetching data from a CouchDB
* database.
@zpaav
zpaav / couchdb-parser.js
Created June 30, 2016 21:40 — forked from tbranyen/couchdb-parser.js
Miso Project - Dataset: CouchDB Parser
// Underscore utility
var _ = require("underscore");
// Miso library
var Miso = require("miso.dataset");
Miso.Parsers.Couchdb = function(data, options) {};
_.extend(Miso.Parsers.Couchdb.prototype, {
parse: function(rows) {
var columns, valueIsObject;
'use strict';
// Dependencies
const gcloud = require('google-cloud', {
projectId: 'sara-bigquery',
keyfileName: 'keyfile.json'
});
const vision = gcloud.vision();
const fs = require('fs');
const async = require('async');
@zpaav
zpaav / plate-snitch.js
Created October 26, 2017 20:38 — forked from taitems/plate-snitch.js
(Extract) Check the status of a vehicle registration and scrape results.
// Open form and submit enquire for `rego`
function getInfo(rego) {
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.open(url)
.type('#registration-number-ctrl input[type=text]', rego)
.click('.btn-holder input')
.waitForSelector('.ctrl-holder.ctrl-readonly')
.html()
.then(function(body) {
@zpaav
zpaav / README-Template.md
Created November 10, 2017 14:37 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@zpaav
zpaav / learn.lua
Created July 18, 2018 01:48 — forked from tylerneylon/learn.lua
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@zpaav
zpaav / LICENSE.txt
Created August 23, 2018 03:16 — forked from addyosmani/LICENSE.txt
Offline Text Editor in < 140 bytes (115 bytes). Powered by localStorage & contentEditable
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Copyright (C) 2014 ADDY OSMANI <addyosmani.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@zpaav
zpaav / minimal-analytics-snippet.js
Created December 19, 2018 18:57 — forked from DavidKuennen/minimal-analytics-snippet.js
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {