Skip to content

Instantly share code, notes, and snippets.

View scottlawsonbc's full-sized avatar

Scott Lawson scottlawsonbc

  • Vancouver, Canada
View GitHub Profile
// ————————————————————————————————————————————————————————————————————————
// TableSorter
// Purpose: Make any <table class="sortable"> clickable by column header
// to sort numerically, by date (YYYY-MM-DD), or lexically.
// ————————————————————————————————————————————————————————————————————————
const TableSorter = {
sort(table, colIndex, dir = 'asc') {
const tbody = table.tBodies[0];
const rows = Array.from(tbody.rows);
const header = rows[0]?.querySelectorAll('th').length ? rows.shift() : null;
@scottlawsonbc
scottlawsonbc / obj.go
Created September 19, 2022 02:39
go ray tracer basic implementation
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@scottlawsonbc
scottlawsonbc / main.cpp
Last active July 23, 2022 01:32
m5stack watering unit firmware for m5stickc
#include <Arduino.h>
#include <EEPROM.h>
#include <M5StickC.h>
const int PIN_SENSOR = 33;
const int PIN_PUMP = 32;
const int PIN_BTNA = 37;
const int PIN_BTNB = 39;
struct controller {