Skip to content

Instantly share code, notes, and snippets.

View kalisjoshua's full-sized avatar

Joshua T Kalis kalisjoshua

View GitHub Profile
@kalisjoshua
kalisjoshua / domaddic.mjs
Created October 21, 2023 22:39
A helper function for adding content to the DOM.
/**
* A helper function for adding content to the DOM. Using pretty standard DOM
* functionality domaddic enables the creation of modules that are capable of
* re-rendering themselves when they decide it to be necessary. Modules enable
* information hiding through scope and function calls so that everything is
* out of the global scope.
*
* Is this at all a good idea? Will it potentially be found to be a horrible
* memory hog/leak? Who can tell. Let's see if this bird has wings!
*
@kalisjoshua
kalisjoshua / tinyTest.mjs
Created August 16, 2023 13:20
A tiny test "runner".
class TestResult {
value: any
constructor (value: any) {
this.value = value
}
}
function assert (a: any, b?: any) {
throw new TestResult(b ? a === b : a)
@kalisjoshua
kalisjoshua / counter-intelligence.js
Created June 12, 2022 10:53
Job Posting Keywords
(function () {
console.clear()
let body = window.getSelection().toString()
const ignored = "able about across and for company more public team the that their they where with work world"
.split(" ")
if (!body) {
alert("You forgot to select the text to search.")
} else {
package main
import (
"fmt"
"math/rand"
"os"
"strconv"
"time"
)
@kalisjoshua
kalisjoshua / README.md
Last active May 29, 2018 13:47
Hypermedia Adventure

Hypermedia Adventure

This will be an adventure in navigating a Hypermedia API. This API will illustrate API standards that should be followed in all APIs.

  1. Where to begin?
    • GET /
    • (non-authenticated)
    • Perform a simple GET request to get a list of available API resources.
  • This resource will always be available - authenticated or not - and will
@kalisjoshua
kalisjoshua / audit.js
Created May 10, 2018 17:52
npm audit added functionality - summary
const fs = require('fs')
const file = './audit.log'
const start = (q) => /^┌[─]+┬[─]+┐$/.test(q)
const split = (q) => /^├[─]+┼[─]+┤$/.test(q)
const close = (q) => /^└[─]+┴[─]+┘$/.test(q)
const audit = fs.readFileSync(file, 'utf-8')
.split(/\n/g)

Keybase proof

I hereby claim:

  • I am kalisjoshua on github.
  • I am kalisjoshua (https://keybase.io/kalisjoshua) on keybase.
  • I have a public key ASB0fmsuRsLx_spNBDE-j91MEdsUorgmX0BtdT20cWEybgo

To claim this, I am signing this object:

const debounce = (fn, delay) => {
let pending
return function postponed (...args) {
pending && clearTimeout(pending)
pending = setTimeout(fn.bind(this, ...args), delay || 200)
}
}
@kalisjoshua
kalisjoshua / compose.js
Created April 13, 2017 13:19
JavaScript function composition.
const compose = (...fns) =>
fns.reduceRight((g, f) => (...args) => f(g(...args)))
@kalisjoshua
kalisjoshua / curry.js
Created April 7, 2017 00:17
Simple - recursive - ES6/2015 curry function.
const curry = (fn, ...args) => args.length < fn.length
? (...add) => curry(fn, ...args.concat(add))
: fn(...args)