Skip to content

Instantly share code, notes, and snippets.

@dlwjiang
dlwjiang / kittensScript.js
Created November 10, 2022 16:25
Kittens Script
const hunt = ".0.2.0.1"
const beam = ".0.5.1.0.3.6.0"
const slab = ".0.5.1.0.4.6.0"
const steel = ".0.5.1.0.6.6.0";
const manuscript = ".0.5.1.0.g.6.0";
const praise = ".0.3.0";
const targets = [hunt, beam, slab, steel, manuscript, praise];
targets.forEach(target => {
@dlwjiang
dlwjiang / yc-derivation.js
Created August 6, 2018 00:17
Y-combinator derivation
/**
* This pretty much works.
* The rest is simplifying and prettifying
* while also extracting the Y-combinator function
* as a generic utility.
*/
const factorial = (f => n => {
if (n < 2) 1;
@dlwjiang
dlwjiang / pa-example.js
Last active August 5, 2018 23:43
Example of JS partial application syntax.
//A function that returns a function
const adder = a => b => a + b
//Read `adder` left to right as params are passed in,
//by passing in 5 as `a` we create the function `b => 5 + b`
const add5 = adder(5);
//this is 8
console.log(add5(3));
@dlwjiang
dlwjiang / expanded-factorial.js
Last active August 5, 2018 23:50
expanded y-combinator factorial
// This writes out the same function twice.
// If you consider the top function `pseudoFactorial` and the bottom function as `copy`
// you can read it as `pseudoFactorial(copy)`
//
// As pseudoFactorial creates a function that creates a function,
// this creates the factorial function, ready to take in `n`
const factorial = (f => n => {
@dlwjiang
dlwjiang / factorial.js
Created August 5, 2018 22:37
factorial
const factorial = (n) => {
if (n < 2) return 1;
return n * factorial(n - 1);
}
@dlwjiang
dlwjiang / gist:0613bea3dfb7552c16f5a30331481cdc
Created November 2, 2017 18:31
Blockstack verification
Verifying my Blockstack ID is secured with the address 13K59BaY72NpbKGm95pZkFZEw6X8BTzwKG https://explorer.blockstack.org/address/13K59BaY72NpbKGm95pZkFZEw6X8BTzwKG
@dlwjiang
dlwjiang / README.md
Last active November 23, 2015 23:41
Spin

#Common Table Tennis Spins

####As seen from server's POV.

##Top Row:

####Topspin

>Causes ball to jump off of opponents racket, often off the table.

@dlwjiang
dlwjiang / README.md
Last active November 5, 2015 23:44
ThrottleDebounce

Understanding Throttle and Debounce Through Analogy:

###Throttle:

A lazy person who ignores your commands until he is rested.

###Debounce:

@dlwjiang
dlwjiang / README.md
Last active November 2, 2015 05:45
Hofstede Comparison
@dlwjiang
dlwjiang / index.html
Last active November 2, 2015 05:46
Spiral Print
<!DOCTYPE html>
<html>
<head>
<title>Spiral Printer</title>
<style type="text/css">
.circle {
cursor : pointer;