Skip to content

Instantly share code, notes, and snippets.

Avatar
💨

Lance Pollard lancejpollard

💨
View GitHub Profile
@lancejpollard
lancejpollard / code.ts
Last active May 24, 2023 13:51
600 line TypeScript error
View code.ts
export type FormLink<
B extends Base,
N extends BaseName<B>,
I extends InterpolateForm<B> = InterpolateForm<B>,
> = JoinReferenceExpression<I, ExtractTableAlias<I, N>, string>
call = call.innerJoin(
link.head.form,
`${link.head.form}.${link.head.name}` as unknown as FormLink<
@lancejpollard
lancejpollard / readme.md
Last active May 9, 2023 23:58
Genesis 1 Brain Translation
View readme.md

1

In the beginning God created the heavens and the earth.

Upon emergence, the great brain mapped out perfection and chaos.

2

Now the earth was formless and desolate, and there was darkness upon the surface of the watery deep, and God's active force was moving about over the surface of the waters.

View query.js
{
action: {
type: {
slug: 'insert',
},
},
filter: {
type: 'flow',
},
select: {
@lancejpollard
lancejpollard / stereographic.ts
Created January 24, 2023 21:06
manifolds/stereographic.ts
View stereographic.ts
type _WeightedMidpointInputType = {
weights: OptionalTorchTensor
reducedim: OptionalListInt
dim: number
keepdim: boolean
lincomb: boolean
posweight: boolean
}
type WeightedMidpointInputType = {
@lancejpollard
lancejpollard / readme.md
Created January 19, 2023 14:21
MagicTile Key Snippets for understanding Hyperbolic Tessellation Implementation
View readme.md
private void TrackClosest( Cell cell )
{
	// Are we tracking?
	if( !m_trackClosest )
		return;

	Complex transformedCenter = m_mouseMotion.Isometry.Apply( cell.Boundary.Center.ToComplex() );
	
	double distToOrigin = transformedCenter.Magnitude;
@lancejpollard
lancejpollard / type.ts
Created December 21, 2022 19:20
Pick and Partial together in TypeScript
View type.ts
type PickPartial<T, M> = Partial<Omit<T, keyof M>> & {
[K in keyof T & keyof M]: M[K] extends object
? PickPartial<T[K], M[K]>
: T[K]
} extends infer O
? { [K in keyof O]: O[K] }
: never
@lancejpollard
lancejpollard / test.dart
Created December 15, 2022 08:05
Dart Example JS Compilation Output
View test.dart
main() {
var i = 0;
// while conditions are evaluated before the loop
while(i++ < 2) {
print("while $i");
}
var j = 0;
@lancejpollard
lancejpollard / tarjans.js
Created November 15, 2022 23:18 — forked from HopefulLlama/tarjans.js
JavaScript implementation of Tarjan's strongly connected components algorithm
View tarjans.js
function Vertex(name) {
this.name = name;
this.index = null;
this.lowlink = null;
this.onStack = false;
this.children = [];
}
function TarjanRunner() {
@lancejpollard
lancejpollard / example.tsx
Created November 8, 2022 15:03
FontObserver React Hook (to prevent FOUC)
View example.tsx
import { useState, useEffect } from 'react'
import FontFaceObserver from 'fontfaceobserver'
export default function useFonts(allFonts, selectedFonts) {
const [isVisible, setIsVisible] = useState(false)
useEffect(() => {
const fonts = selectedFonts.length
? selectedFonts.map(name => allFonts[name])
@lancejpollard
lancejpollard / list.csv
Created October 27, 2022 03:46
English Adverbs not Ending with -ly (from Wiktionary)
View list.csv
word
abread
abreast
abrest
abrim
abroach
abroad
abrode
abrood
abubble