Skip to content

Instantly share code, notes, and snippets.

View tmathews's full-sized avatar
🌠

Tom tmathews

🌠
View GitHub Profile
// Define modules.
need("cookie", function ( need ){
function Cookie ( type ) {
this.type = type;
}
Cookie.prototype.getName = function () {
return this.type + " Cookie";
}
@tmathews
tmathews / download-mp3s.js
Last active December 5, 2024 03:13
Download all mp3 links on a html page.
var http = require("http");
var fs = require("fs");
var url = "http://f.starfox-online.net/sf64/voiceclips/";
var request = http.get(url, function ( response ) {
var body = "";
response.on("data", function ( chunk ) {
body += chunk;
});
MMM
MMMMM
MMMMMM
MM MMMMMMM
MMMMM MMMMMMMMMMMMMMMM
MMMMMM MMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMM MMMMMMMMMMM
MMMMMMMMM MMMMMMMMMMMM
MMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMM
function hex ( n ) {
//See: http://www.javascripter.net/faq/rgbtohex.htm
n = parseInt(n,10);
if (isNaN(n)) return "00";
n = Math.max(0,Math.min(n,255));
return "0123456789ABCDEF".charAt((n-n%16)/16)
+ "0123456789ABCDEF".charAt(n%16);
}
function clamp ( value, min, max ) {
return Math.max(min, Math.min(value, max));
}
@tmathews
tmathews / ellipse-detect.md
Last active April 15, 2018 15:05
Point in Ellipse