Skip to content

Instantly share code, notes, and snippets.

View TehShrike's full-sized avatar
🕺
Groovy.

Josh Duff TehShrike

🕺
Groovy.
View GitHub Profile
const Jimp = require(`jimp`)
const imagemin = require('imagemin')
const imageminPngquant = require('imagemin-pngquant')
const { readdirSync } = require(`fs`)
const { join } = require(`path`)
const relativeToThisFile = relativePath => join(__dirname, relativePath)
const inputPath = relativeToThisFile(`../../book-cover-image`)
const outputPath = relativeToThisFile(`../../Markdown/Web/book-image/thumbnail`)
@TehShrike
TehShrike / daysInMonth.js
Last active January 10, 2020 19:43
daysInMonth.js
// An expansion of https://stackoverflow.com/a/1184359/201789
function daysInMonth (oneIndexedInputMonth, year) {
const zeroIndexedInputMonth = oneIndexedInputMonth - 1
const theNextZeroIndexedMonth = zeroIndexedInputMonth + 1
const theFinalDayOfThePreviousMonth = 0
return new Date(year, theNextZeroIndexedMonth, theFinalDayOfThePreviousMonth).getDate()
}
@TehShrike
TehShrike / command.sh
Created July 4, 2019 11:50
Sublime Text as git editor
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w"
@TehShrike
TehShrike / eslint cli arguments.txt
Last active August 11, 2022 16:11
Ignore fixable eslint rules
eslint --rule 'no-extra-boolean-cast: 0' --rule 'no-extra-parens: 0' --rule 'no-extra-semi: 0' --rule 'no-regex-spaces: 0' --rule 'no-unsafe-negation: 0' --rule 'curly: 0' --rule 'dot-location: 0' --rule 'dot-notation: 0' --rule 'eqeqeq: 0' --rule 'no-else-return: 0' --rule 'no-extra-bind: 0' --rule 'no-extra-label: 0' --rule 'no-floating-decimal: 0' --rule 'no-implicit-coercion: 0' --rule 'no-multi-spaces: 0' --rule 'no-unused-labels: 0' --rule 'no-useless-return: 0' --rule 'wrap-iife: 0' --rule 'yoda: 0' --rule 'strict: 0' --rule 'no-undef-init: 0' --rule 'array-bracket-newline: 0' --rule 'array-bracket-spacing: 0' --rule 'array-element-newline: 0' --rule 'block-spacing: 0' --rule 'brace-style: 0' --rule 'capitalized-comments: 0' --rule 'comma-dangle: 0' --rule 'comma-spacing: 0' --rule 'comma-style: 0' --rule 'computed-property-spacing: 0' --rule 'eol-last: 0' --rule 'func-call-spacing: 0' --rule 'function-paren-newline: 0' --rule 'implicit-arrow-linebreak: 0' --rule 'indent: 0' --rule 'jsx-quotes: 0' --ru
@TehShrike
TehShrike / wrap-commonjs.js
Created February 9, 2019 21:59
Wrap CommonJS into a UMD-like thingy
const yourModule = (() => {
const module = { exports: {} }
/* your module here */
module.exports = {
test: true,
}
/* end your module */
@TehShrike
TehShrike / Preface.md
Last active April 4, 2023 19:12
Bible Acrostic: An Aid to Memorizing the Content of Every Chapter of the Bible

Preface

The source material for this booklet was given to me by a trusted Pastor/friend. He mentioned it in the context of a discussion about a feat that may seem audacious... to memorize the content of every chapter of the Bible.

(For helpful guidelines and encouragement for Extended Memorization, see Rev. Andrew Davis’ Written on Your Heart: An Approach to Extended Memorization of Scripture. Many of his principles are applicable to this Book/Chapter summary memorization task; the main lesson being PRACTICE.)

Well, I am one for adventurous and ambitious (if not audacious) endeavors, so I produced this booklet as I proceeded through a read- the-Bible-in-a-year reading program with my family. When we read each morning and evening I learned that day’s phrases.

*(Much of the year I was right on track with my memorization and when I fell behind a few days it wasn’t too hard to catch up. All told, I accomplished my goal but of course now (and for the years to come) I need to continue to practice in order

@TehShrike
TehShrike / reproduction.ts
Created October 31, 2018 16:04
deno issue
const main = async () => {
const getResponse = await fetch('https://postman-echo.com/get', {
headers: {
'User-Agent': 'test'
}
})
console.log('GET response:', await getResponse.text())
const postResponse = await fetch('https://postman-echo.com/post', {
@TehShrike
TehShrike / chunk-while.js
Last active September 12, 2018 20:48
chunkWhile
const chunkWhile = (iterable, condition) => [...chunkGenerator(iterable, condition)]
function* chunkGenerator(iterable, condition) {
let currentChunk = []
for (const element of iterable) {
currentChunk.push(element)
if (!condition(element)) {
yield currentChunk
currentChunk = []
}
@TehShrike
TehShrike / .eslint-fixable.js
Last active February 7, 2019 23:39
Fixable eslint config
const never = [ 'warn', 'never' ]
const always = [ 'warn', 'always' ]
const asNeeded = [ 'error', 'as-needed' ]
module.exports = {
plugins: [
'html',
],
parserOptions: {
ecmaVersion: 8,
@TehShrike
TehShrike / q.sh
Created February 2, 2018 19:44
Get daily totals out of Toggl
# gotta remove spaces from the column names in the csv first
q -d , -H "SELECT Startdate, SUM(ROUND((((STRFTIME('%H', Endtime) * 60) + STRFTIME('%M', Endtime)) - ((STRFTIME('%H', Starttime) * 60) + STRFTIME('%M', Starttime)) * 1.0) / 60, 2)) FROM Toggl_time_entries_2018-01-16_to_2018-01-31.csv GROUP BY Startdate"