I hereby claim:
- I am lukekarrys on github.
- I am lukekarryz (https://keybase.io/lukekarryz) on keybase.
- I have a public key ASDHFjKV-21jX2bEkz2emB4ZXj2ZhBPPKlhHvbJsxnzYoAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
const http = require("http"); | |
const fs = require("fs"); | |
const serve = (res, data, headers) => { | |
res.writeHead(200, headers); | |
res.end(data); | |
}; | |
const randomName = () => Math.random().toString().slice(2); |
const { Octokit } = require("@octokit/core"); | |
const fs = require("fs").promises; | |
const octokit = new Octokit({ | |
auth: "GH_REPO_TOKEN", | |
}); | |
const ORG = process.argv[2]; | |
const PER_PAGE = 100; | |
const getAll = async () => { |
import { JSDOM, VirtualConsole } from "jsdom"; | |
import fetch from "node-fetch"; | |
const appleUrl = (p) => { | |
return new URL(p, `https://www.apple.com`); | |
}; | |
const fetchPage = async (url) => { | |
const res = await fetch(appleUrl(url)); | |
const html = await res.text(); |
Linked to from http://lukecod.es/2012/11/18/random-problem-of-the-night/
This is a node.js crawler that will crawl an entire site (using crawl) to find all internal links in the entire site. It will then test each unique internal link for the presence of an optional string and then the query string into an object. All values with the same key from the query string will be pushed to an array for that key.
node_modules/ |
/*global require console */ | |
var _ = require('underscore'), | |
fs = require('fs'), | |
data = JSON.parse(fs.readFileSync('./data.json', 'utf-8')).data; | |
_.each(data, function(item) { | |
var newJson = item[0], | |
files = item[1]; |
module.exports = (keys) => new Proxy( | |
keys.reduce((acc, key) => ((acc[key] = key), acc), {}), | |
{ | |
get: function(target, name) { | |
// Since this getter gets called for all keys, some values need to be ignored | |
if ( | |
// If this proxy gets logged or inspected then name | |
// could be a symbol or the string inspect | |
typeof name === 'symbol' || | |
name === 'inspect' || |
const timeToSeconds = (t) => t | |
.split(':') | |
.reverse() | |
.reduce((acc, value, i) => acc + value * Math.pow(60, i), 0) | |
const timesToPoints = (...times) => Math.round(times[0] / times[1] * 1000) | |
const main = (...times) => { | |
const parsed = times.map(timeToSeconds) | |
if (parsed.length === 3) { |
node_modules | |
token.json | |
db.json |