Skip to content

Instantly share code, notes, and snippets.

View aarongilly's full-sized avatar

Aaron Gillespie aarongilly

View GitHub Profile
@aarongilly
aarongilly / test-gist.md
Last active February 6, 2022 20:08
This is just a test.

Test Gist

This is a gist I made. I fully don't get it yet.

Seems unnecessary for my purposes.

@aarongilly
aarongilly / tiny-timestamp.ts
Created February 22, 2022 01:42
Three examples of single line functions to create tiny timestamps, tiny unique IDs, and parse dates from them.
//This is a few lines of code that produces a base36 timestamp
function mkTt() { return new Date().getTime().toString(36)}
//len is any number between 0 and 10
function mkId(len=3){ return new Date().getTime().toString(36)+"."+Math.random().toString(36).slice(13-len).padStart(len,"0") }
//this will pull the date portion of the mkId and will parse the mkTt
function parseDate(tinyId){new Date(parseInt(tinyId.split(".")[0],36))}
@aarongilly
aarongilly / Domino-train.js
Last active December 11, 2022 21:34
Dominoes Valid Train Finder
/**
* Will find all permutations of the given set of 'dominos' that can
* be laid in a single line end to end to form a valid domino train.
*/
function start() {
const dominos = ['05','60','54','66','40','43','21','35','03','24','32','52','11'];
dominos.forEach(domino=>{
let remaining = dominos.filter(d=>d!=domino);
lookForValidTrain([domino], remaining);
})
@aarongilly
aarongilly / filedropComp.svelte
Created September 29, 2023 17:27
Svelte File Input Component
<script lang="ts">
/**
* When a file is dropped here (or selected via browsing) this is the function that will be called back
*/
export let fileCallback: (file: File)=>any
function handleDrop(ev: any) {
// Prevent default behavior (Prevent file from being opened)
ev.preventDefault();
(<HTMLDivElement>ev.target).classList.remove("drug");
@aarongilly
aarongilly / timeTriggered.js
Last active December 8, 2024 06:14
Basic "New Row" Code for Google Apps Script bound to a particular type of Sheet
//#region ---- ABOUT ----
/**
* This Code is meant to be published as a Google Apps Script WebApp.
*
* # Pre-work
* ## Setting Trigger to add a new row each day.
* 1. Set a "Trigger" in Apps Script to run the `oneAM()" function each night between midnight and 1am. This makes a new row for you & copies formulas to it.
*
* ## Making the web app
* 1. Click Publish > Deploy as web app...
@aarongilly
aarongilly / combined.md
Created January 26, 2025 15:10
A concatenation of all blogs entries in my blog to date

date: 2012-08-30T00:00:00.000Z tags:

  • PICTURES
  • LIFE title: '#28 - TL;DR: California is Awesome.' aliases: '#28 - TL;DR: California is Awesome.' draft: false enableToc: true permalink: '28'