Skip to content

Instantly share code, notes, and snippets.

View taitems's full-sized avatar

Tait Brown taitems

View GitHub Profile
@taitems
taitems / cleanup3dObject.js
Created October 17, 2023 05:49
Recursive three.js scene cleanup
import * as THREE from 'three';
export const cleanup3dObject = function (obj) {
if (obj instanceof THREE.Object3D || obj instanceof THREE.Scene) {
// Dispose of all children
obj.traverse(function (child) {
if (child instanceof THREE.Mesh || child instanceof THREE.SkinnedMesh) {
// Dispose of the geometry and material to release resources
child.geometry.dispose();
var webhookUrl = 'PUT YOUR WEBHOOK URL HERE';
var startTag = '<!-- START VEHICLE LISTING -->';
var endTag = '<!-- END VEHICLE LISTING -->';
var urlRegex = new RegExp(/(https?:\/\/[^\s]+)/g);
var titleRegex = new RegExp(/\d\d\d\d\s.*/g);
var listings = findListing(inputData.emailHtml);
var str = findLinks(listings);
postToSlack(str);
@taitems
taitems / plate-snitch.js
Created August 20, 2017 04:01
Image processing to identify license plate
openalpr.IdentifyLicense(imagePath, function (error, output) {
// handle result
});
@taitems
taitems / plate-snitch.js
Created August 20, 2017 03:56
(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) {
@taitems
taitems / Console Capture
Created August 15, 2011 02:34
Prevent console.log()s from causing JS errors
if (!window.console) {
window.console = {};
window.console.log = function() {
return false;
};
}