Skip to content

Instantly share code, notes, and snippets.

@nns2009
nns2009 / RandomSort.js
Last active September 8, 2020 15:26
Random Sort incorporates principles of security through obscurity to make your most sensitive pieces of code safe
// Watch this video to see how I crafted this sorting algorithm:
// https://youtu.be/Mh_1V95n0j0
function bDQnoAh__3IqiQ6w(MbK$rQXzgSJSupW) {
return Math.floor(Math.random() * MbK$rQXzgSJSupW);
}
function E68sk_VA6aM3y9ts1DO4S(xAAyxUzJedDW4t_) {
for (let SUiFIpIVdvQFCy = 1; SUiFIpIVdvQFCy < xAAyxUzJedDW4t_.length; SUiFIpIVdvQFCy++) {
if (xAAyxUzJedDW4t_[SUiFIpIVdvQFCy-1] > xAAyxUzJedDW4t_[SUiFIpIVdvQFCy])
@nns2009
nns2009 / 1 Minute Game.py
Last active September 1, 2020 09:55
I made a game in under one minute, here it is
# Made in 37 seconds
# Watch this video to see how:
# https://youtu.be/uvKG7uki_N8
# Play the extended HTML port on Itch:
# https://nns2009.itch.io/guess-with-lies
from random import randrange
n = randrange(10000)
while True:
v = int(input())
@nns2009
nns2009 / BinaryTreeSort.js
Last active June 13, 2024 09:36
Binary Tree Sort in 3 lines of code in JavaScript
// Watch https://youtu.be/KvYzGsz5vHA to see how I coded this with some commentary
let add = (n, v) => !n ? { v } : { ...n, [v < n.v]: add(n[v < n.v], v) }
let flat = n => !n ? [] : [...flat(n[!0]), n.v, ...flat(n[!1])]
let bsort = vs => flat(vs.reduce(add, null))
// 182 characters with nice formatting
let add=(n,v)=>!n?{v}:{...n,[v<n.v]:add(n[v<n.v],v)}
let flat=n=>!n?[]:[...flat(n[!0]),n.v,...flat(n[!1])]
let bsort=vs=>flat(vs.reduce(add,null))