Skip to content

Instantly share code, notes, and snippets.

View TehShrike's full-sized avatar
🕺
Groovy.

Josh Duff TehShrike

🕺
Groovy.
View GitHub Profile
@TehShrike
TehShrike / .zprofile
Last active February 13, 2025 15:39
.zprofile 2025-02-13
eval "$(/opt/homebrew/bin/brew shellenv)"
alias sublime="open -a 'Sublime Text.app'"
# alias mysql="/usr/local/mysql/bin/mysql"
alias mysql-start="/usr/local/mysql/support-files/mysql.server start"
alias flushcache="dscacheutil -flushcache;sudo killall -HUP mDNSResponder"
alias jsdate="node -e \"console.log(new Date())\""
alias lsl="ls -l"
alias gh=gh-home
alias gum="git fetch upstream && git checkout upstream/master"
@TehShrike
TehShrike / write_csv.ts
Created January 24, 2025 03:38
write csv
const requires_quoting_regex = /["\n,]/
const escape_quotes = (str: string) => str.replace(/"/g, `""`)
export const escape_csv_value = (str: string) => requires_quoting_regex.test(str)
? `"${ escape_quotes(str) }"`
: str
export const csv_line = (...values: string[]) => values.map(escape_csv_value).join(`,`)
@TehShrike
TehShrike / gary_north_theory_of_fat_books.md
Created October 3, 2024 04:48
Gary North: Fat Books and Social Transformation

From the introduction to Tools of Dominion: The Case Laws of Exodus.

Fat Books and Social Transformation

This is a fat book. I have no illusions about its becoming a best-seller. But I hold to what I call the fat book theory of social transformation. Most of the major turning points in Western history have had fat books at their center. The Bible is certainly a fat book. Augustine's City of God is a fat book, and by adhering to the biblical worldview, it restructured Western civilization's concept of history. Thomas Aquinas' Summa Theologica is a fat book, and it gave the medieval West the crucial synthesis of scholastic philosophy, an in- tellectual tradition still defended by a handful of Roman Catholic conservatives and (implicitly, at least) by most contemporary Protestant fundamentalist philosophers. John Calvin's Institutes of the Christian Religion is a fat book, and it structured a large segment of Reformation theology.

Christians have not been the only social transformationists who have w

@TehShrike
TehShrike / parse_csv_line.ts
Created March 13, 2024 15:33
parse a csv line
import test from 'lib/tester';
const parse_csv_line = (line: string): string[] => {
const chunks: string[] = [];
let inside_quotes = false;
let current_chunk = '';
for (let i = 0; i < line.length; ++i) {
const char = line[i];
@TehShrike
TehShrike / get_utc_offset.mjs
Last active April 8, 2022 15:15
get utc offset
import tz_tokenize_date from './tz_tokenize_date.mjs'
const ZERO_HOUR_UTC = `T00:00:00.000Z`
const ZERO_HOUR_MINUS_TWENTY_HOURS_UTC = `T00:00:00.000-20:00`
const ZERO_HOUR_PLUS_TWENTY_HOURS_UTC = `T00:00:00.000+20:00`
export const day_to_offset_at_start_of_day = (iana_timezone_string, iso_day_string) => {
const valid_offset = [
iso_day_string + ZERO_HOUR_MINUS_TWENTY_HOURS_UTC,
iso_day_string + ZERO_HOUR_UTC,
1 cup water
1Tbsp active yeast
1tsp honey
2 eggs, room temperature, slightly beaten
1 cup oat fiber
2/3 cup ground golden flax meal
1 cup vital wheat gluten
1/2tsp xanthum gum
1tsp salt
2Tbsp softened butter
@TehShrike
TehShrike / get_timezone_offset_for_point_in_time.js
Created April 19, 2021 17:39
get_timezone_offset_for_point_in_time
// from https://github.com/bsvetlik/date-fns-tz/blob/eb2bb6209931c5abe1cfcdf2faaa41de5493648a/src/_lib/tzParseTimezone/index.js#L86-L98
export default (iana_timezone_string, date_object) => {
const [ year, month, day, hour, minute, second ] = tz_tokenize_date(
date_object,
iana_timezone_string,
)
const asUTC = Date.UTC(year, month - 1, day, hour, minute, second, date_object.getMilliseconds())
return asUTC - date_object.getTime()
@TehShrike
TehShrike / .eslintrc.js
Last active November 16, 2020 15:27
.eslintrc.js
const warn = [ 'warn' ]
const error = [ 'error' ]
const never = [ 'warn', 'never' ]
const always = [ 'warn', 'always' ]
const asNeeded = [ 'error', 'as-needed' ]
module.exports = {
plugins: [
// 'html',
@TehShrike
TehShrike / date-range-input.js
Last active July 24, 2023 17:39
Svelte custom element wrapper
import DateRangeInput from "@equipmentshare/date-range-input"
import makeCeFromSvelte from "common/svelte-ce"
export default makeCeFromSvelte(DateRangeInput, {
mirrorProps: [ "start", "end", "visibleStartMonth", "visibleEndMonth" ],
requiredToInstantiate: [ "start", "end" ],
mirrorEvents: [ "change" ],
// Shouldn't be necessary now that https://github.com/sveltejs/svelte/issues/3940 is fixed
initialHtml: "<style>@import './date-range-input/component.css';</style>",
@TehShrike
TehShrike / weekday-names.js
Created January 21, 2020 23:04
The names of the days of the week using browser locale
const anArbitrarySundayEarlyInTheMonth = new Date(2020, 0, 5)
const dayNumbers = [ 0, 1, 2, 3, 4, 5, 6 ]
const formatter = new Intl.DateTimeFormat(undefined, {
weekday: `short`,
})
const weekdayNames = dayNumbers.map(dayNumber => {
const date = new Date(anArbitrarySundayEarlyInTheMonth)
date.setDate(date.getDate() + dayNumber)
return formatter.format(date)