Skip to content

Instantly share code, notes, and snippets.

kurtroberts / gist:5768cecc052145e8fc34
Created Jun 2, 2015
I remember when Project Managers would pay IA contractors to audit the content on a site, and they'd just give us back a spreadsheet full of links...
View gist:5768cecc052145e8fc34
//Collecting links is a below-the-api job...
var huntsman = require('huntsman'),
spider = huntsman.spider(),
fs = require('fs'),
out = fs.createWriteStream('');
spider.extensions = [
huntsman.extension( 'recurse' ), // load recurse extension & follow anchor links
kurtroberts / gist:ed26aa5a71cd784a153b
Created Jul 7, 2015
First exploration of my "N things about X" article-writing robot
View gist:ed26aa5a71cd784a153b
var summary = require('node-tldr'),
sentiment = require('sentiment'),
opts = require('nomnom')
.option('url', {
abbr: 'u',
help: 'URL to summarize',
required: true
summary.summarize(opts.url, function(result, failure) {
kurtroberts / gist:c7ffb93b0822c07508f3
Created Jul 7, 2015
Create a CSV file with some basic SEO evaluation
View gist:c7ffb93b0822c07508f3
var huntsman = require('huntsman'),
spider = huntsman.spider(),
fs = require('fs'),
opts = require('nomnom')
.option('domain', {
abbr: 'd',
help: 'Domain to scan.',
required: true
.option('startUrl', {
kurtroberts / test.js
Created Oct 13, 2015
I really thought at the level of abstraction we typically work (Node.js) the idea of "write combining" wasn't going to make a difference. I was wrong.
View test.js
//To understand how I started down this rabbit hole, go here:
var iterations = parseInt(2147483647 / 128);
//Base case, no optimization
function runCaseOne () {
var i = iterations,
arrayA = [],
arrayB = [],
kurtroberts / reverse-proxy.js
Created Dec 24, 2013
For the first useful thing I ever built in node, I hacked together this reverse proxy script so that I could fiddle with front-end code on a remote website more easily. It sits between your computer and the remote site, checking first for files in a folder you specify, then trying a GET request against the site.
View reverse-proxy.js
var http = require('http'),
path = require('path'),
fs = require('fs'),
localPath = "/PATH/TO/LOCAL/FOLDER/",
remoteServer = { host: '',
port: 80
mimeTypes = { 'js' : 'text/javascript',
'css' : 'text/css',
'html' : 'text/html',
kurtroberts / rg3bot.js
Created Dec 24, 2013
Get yourself banned from twitter in about 3 seconds. Cleaning out more old code that I will never need. This one was from the RP3 -> RG3 conversion.
View rg3bot.js
var twitter = require('ntwitter');
var twit = new twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
});'statuses/filter', {'track': 'rgiii'}, function(stream) {
kurtroberts /
Created Dec 24, 2013
For when sloppy coders can't keep their case straight. I never believed this possible, but after contracting with a firm who's name I will not mention for a team, I got back about 200 json files with randomly capitalized names. Despite being very clear we were deploying to an apache2 server on Linux, they tested on their case-insensitive Windows…
#!/usr/bin/perl -w
opendir DIR, ".";
my @files = grep { $_ ne '.' && $_ ne '..' } readdir DIR;
closedir DIR;
for $file (@files) {
my $lfile = lc($file);
if ($lfile ne $file) {
print $file . "\n";
kurtroberts / workDays.js
Created Feb 24, 2016
Fun with Generators
View workDays.js
var getNextDay = function (initialDate) {
initialDate.setDate(initialDate.getDate() + 1);
return initialDate;
dayOff = function (day) {
if (day.getDay() == 0 || day.getDay() == 6) {
return true;
return false;

Keybase proof

I hereby claim:

  • I am kurtroberts on github.
  • I am kurtroberts ( on keybase.
  • I have a public key ASA70wmzqCJjoErdlX8kpu7lj9CdWPXYcWL_lHdFwa7EIgo

To claim this, I am signing this object:

kurtroberts / index.js
Created Nov 12, 2017
One-stop understanding of Promises...
View index.js
//TL;DR - Read the MDN page and skip all the tutorials:
var x = new Promise((resolve, reject) => {
setTimeout(function () { resolve('test'); }, 5000);
x.then((msg) => console.log(msg));