Skip to content

Instantly share code, notes, and snippets.

View travishorn's full-sized avatar
💡
Trying new ideas

Travis Horn travishorn

💡
Trying new ideas
View GitHub Profile
@travishorn
travishorn / download-classdojo-media.md
Last active April 3, 2025 03:46
Saving the images and videos from your ClassDojo storyline

Archived

Please see Patrick330's fork of this script.

ClassDojo changes their site regularly, so a script like this needs regular maintenance. I have decided to archive this project and stop providing updates. Patrick330's fork linked above may be a good alternative.

Original Purpose

ClassDojo is a classroom communication app used to share reports between parents and teachers. Teachers track student behavior and upload photos or videos. The gamification style system teaches developmental skills through real-time feedback.

@travishorn
travishorn / _ESLint-Prettier.md
Last active July 11, 2024 13:28
Set up project with ESLint and Prettier

Install the VS Code extensions:

  1. Open VS Code
  2. Ctrl + Shift + X
  3. Search for "ESLint"
  4. Click the blue "Install" button
  5. Search for "Prettier"
  6. Click the blue "Install" button

In your project directory (the one containing package.json), install the development dependencies:

@travishorn
travishorn / cargo-watch.sh
Created April 17, 2023 03:39
Cargo Watch - Reload and run Rust code on change
cargo watch -c -w src -x run
# -c : Clear the terminal before each reload
# -w : Which files to watch
# -x : What command to execute
# cargo-watch must be installed.
cargo install cargo-watch
@travishorn
travishorn / clone-identity.sh
Created April 17, 2023 03:53
git clone via SSH with an identity file (private key)
git clone myusername@myserver:/home/git/myrepo
# `myusername` is your username on the server which hosts a bare git repository
# `myserver` is a `Host` configured in `~/.ssh/config` on your local machine
# `/home/git/myrepo` is the path to the bare repository on the server
@travishorn
travishorn / no-history-filter-change.js
Last active July 20, 2023 20:05
Submit form on control change without pushing new state to history
// A pattern I often find myself using consists of a report-type page that
// displays any amount of data. At the top of that page is a `<form>` containing
// one or more `<select>` elements whose purpose is to filter the data on the
// report.
// The form uses `method="GET"`, which is great to make sure that the URL stays
// in line with what the page shows. A user can bookmark/favorite the URL and
// come back to it later. A user can share the URL so other users can see
// exactly the same page.
@travishorn
travishorn / custom-encoding.mjs
Created October 24, 2024 14:36
An example of building custom encoding/decoding functions to pack (well-defined and well-formed) data into smaller space.
// Use the `Buffer` class. Requires Node.js.
import { Buffer } from "node:buffer";
/**
* @typedef CommodityPrice
* @property {string} id - A unique identifier for this piece of information
* @property {string} commodityId - The identifier for the commodity
* @property {Date} postedAt - When this price was posted
* @property {number} price - The price of the commodity when posted
*/
@travishorn
travishorn / _Node Tests.md
Last active October 24, 2024 17:44
How to use Node's built in test runner and assertion library.

Node Tests

How to use Node's built in test runner and assertion library.

@travishorn
travishorn / ._Node Env File.md
Last active October 24, 2024 17:50
Using Node's built-in support for environment variable files (.env files).

Node Env File

Using Node's built-in support for environment variable files (.env files).

@travishorn
travishorn / ._Node Watch.md
Created October 24, 2024 17:49
Using Node's built-in watch mode.

Node Watch

Using Node's built-in watch mode.

@travishorn
travishorn / shrinkvid.ps1
Created November 26, 2024 01:40
Takes a video file and trims it to a specified time range, while also adjusting quality for a smaller, shareable size.
# Takes a video file and trims it to a specified time range, while also
# adjusting quality for a smaller, shareable size.
#
# Example usage:
# .\shrinkvid.ps1 video.mp4 00:00:10 00:00:20
#
# This will invoke ffmpeg with the following command:
# ffmpeg -i "video.mp4" -vf scale=-2:720 -r 60 -crf 28 -ss 00:00:10 -to 00:00:20 "video_small.mp4"
#
# Make sure ffmpeg.exe is in your PATH