Skip to content

Instantly share code, notes, and snippets.

View forivall's full-sized avatar
🕴️
levitating

Emily Marigold Klassen forivall

🕴️
levitating
View GitHub Profile
@forivall
forivall / alias_participants.mmd
Created June 17, 2019 20:54
sequenceDiagram mermaid files extracted from spec
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@forivall
forivall / y-combinator.ts
Last active March 27, 2024 03:38
Typescript Y-Combinator
// my brain decided to ask the question: yknow, i want you to think about the y combinator --
// like, what is it. like what the fuck girl, cmon, you have a comp sci degree, you should know this, and understand it and shit
// and so i was like fiiiiiiiiiiiiiiine gosh, lets see if typescript can handle the typing, and play around with it
// so i looked up a javascript implementation, and played with the type defintion until it
// matched up and then i was like oh: thats what the type definition of the functions in it are.
// i get it now. that's pretty cool. the main interesting thing is a the inner function that takes itself
// and returns the function initially passed to the outer function. neato.
@forivall
forivall / axios-timing.ts
Last active March 21, 2024 16:38
Axios Timing helper POC
import http = require('http')
import https = require('https')
import url = require('url')
import {AxiosInstance, AxiosInterceptorManager} from 'axios'
import {HttpRequestOptions as HttpFollowRequestOptions, http as httpFollow, https as httpsFollow} from 'follow-redirects'
import now = require('performance-now')
import httpAdapter = require('axios/lib/adapters/http')
import InterceptorManager = require('axios/lib/core/InterceptorManager')
@forivall
forivall / print.ts
Last active July 5, 2018 18:13
General purpose command line print helper
export type WriteFn = (s: string) => void
export type TemplatePrintFn = (s: TemplateStringsArray, ...values: any[]) => void
export function print(write: WriteFn | null, mapOrOptions: ((value: any) => string) | util.InspectOptions): TemplatePrintFn
export function print(s: TemplateStringsArray, ...values: any[]): void
export function print(s: TemplateStringsArray | WriteFn | null, ...values: any[]): TemplatePrintFn | void {
if (!(typeof s === 'function' || s === null)) {
console.log(_print(inspect, s, values))
return
}
import {DoneVerifyFunc} from 'passport-azure-ad'
function safe<TUser, A1>(
handler: (a1: A1) => PromiseLike<TUser>
): (a1: A1, done: DoneVerifyFunc<TUser>) => void
function safe<TUser, A1, A2>(
handler: (a1: A1, a2: A2) => PromiseLike<TUser>
): (a1: A1, a2: A2, done: DoneVerifyFunc<TUser>) => void
function safe<TUser, A1, A2, A3>(
handler: (a1: A1, a2: A2, a3: A3) => PromiseLike<TUser>
type TemplateAtom<T = any> = () => never
function t<T>(): TemplateAtom<T>
function t(strings: TemplateStringsArray): () => string
function t<A1>(strings: TemplateStringsArray, a1: TemplateAtom<A1>): (a1: A1) => string
function t<A1, A2>(strings: TemplateStringsArray, a1: TemplateAtom<A1>, a2: TemplateAtom<A2>): (a1: A1, a2: A2) => string
function t<A1, A2, A3>(strings: TemplateStringsArray,
a1: TemplateAtom<A1>, a2: TemplateAtom<A2>, a3: TemplateAtom<A3>
): (a1: A1, a2: A2, a3: A3) => string
function t<A1, A2, A3, A4>(strings: TemplateStringsArray,
@forivall
forivall / hello.xml
Last active June 5, 2018 19:00
xslt webpage example
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://rawgit.com/forivall/6a65862b134ee73db9ed3169bd161efd/raw/426d4433a7d04bc167056f0b933dd1c008f1d222/hello.xsl"?>
<hello-world> <greeter>An XSLT Programmer</greeter> <greeting>Hello, World!</greeting></hello-world>
const mask = (1<<6) - 1
const crypto = require('crypto')
function randString(l) {
// let randomFills = 0
// let moves = 0
const b = Buffer.alloc(l * 2)
const bl = b.length
let ok = 0
@forivall
forivall / index.js
Created May 18, 2018 01:31
xo fixes for ignores and overrides (wip)
'use strict';
const path = require('path');
const eslint = require('eslint');
const globby = require('globby');
const isEqual = require('lodash.isequal');
const multimatch = require('multimatch');
const arrify = require('arrify');
const optionsManager = require('./lib/options-manager');
const mergeReports = reports => {
interface CustomPromisify<F> {
(...args): any
__promisify__: F
}
type PromiseAsBluebird<P> = P extends PromiseLike<infer T> ? B<T> : B<P>
type ChangeReturnTypeFromPromiseToBluebird6<F> = F extends
((a1: infer A1, a2: infer A2, a3: infer A3, a4: infer A4, a5: infer A5, a6: infer A6) => PromiseLike<infer R>) ?