Skip to content

Instantly share code, notes, and snippets.

View evinism's full-sized avatar

Evin Sellin evinism

View GitHub Profile

Keybase proof

I hereby claim:

  • I am evinism on github.
  • I am evin (https://keybase.io/evin) on keybase.
  • I have a public key ASA1VVl2QJhgpn5JxFwEhxcK8Uk_PuwkO8sgP5d75lMzLwo

To claim this, I am signing this object:

// copy paste this script into the JS console on xkcd.com
// you can open the js console by pressing cmd-alt-j
// or by right clicking, pressing "inspect element", and navigating to the tab that says console.
const amt = 2000;
$('body').html('');
const getImageUrl = (num) => 'http://generated.inspirobot.me/00' + (Math.floor(num / 10000) + 1) + '/aXm' + (num - Math.floor(num / 10000)*10000 + 1) + 'xjU.jpg';
=== Background ===
For one issue at work, we tossed around the idea of generating UUIDs
clientside in order to ensure that we had a unique immutable id without
having to go to the server to get an ID back, primarily for p2p applications.
Obviously, if somebody's maliciously creating ids, they can choose arbitrary
values and create collisions. Additionally, one client could tell if another
client had already chosen a certain value for an id by trying to commit a
certain UUID to the db.
λf.λx.f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.b)(f(λa.λb.a)(f(λa.λb.a)(f(λa.λ
@evinism
evinism / millieql.md
Last active September 15, 2021 02:17

MilliEQL

A small embeddable query language

MilliEQL is a small query language built for embedding within applications. It supports logic for querying and manipulating data in a simple, typesafe manner.

Motivation

Having a simple query language allows

  • Shared frontend / backend logic for form validation or price calculation.
  • User-submitted logic
@evinism
evinism / barestrings.js
Created October 17, 2021 22:32
Chaotic JS Patterns files
const bareStrings = new Proxy({}, {
has(_, prop){
return window[prop] === undefined;
},
get(_, prop){
return prop.toString();
}
});
with(bareStrings){
@evinism
evinism / noindexing.js
Last active October 18, 2021 06:36
cjsp1
const cat = {
variant: 'hunter',
preferredPrey: 'anything',
}
const dog = {
variant: 'sniffer',
smellSkill: 'excellent'
}
@evinism
evinism / yesindexing.js
Created October 17, 2021 22:37
cjsp2
class Indexable {
constructor(){
this._indexer = Symbol();
}
[Symbol.toPrimitive](){ return this._indexer }
}
class Animal extends Indexable {}
const cat = new Animal();
@evinism
evinism / nukedclosure.js
Last active October 18, 2021 18:30
cjsp3
function only(definedItems){
return new Proxy({}, {
has(_, prop){
return !definedItems.includes(prop);
},
get(_, prop){
throw new Error("Referenced variable " + prop.toString() + " out of scope!");
},
set(_, prop){
throw new Error("Referenced variable " + prop.toString() + " out of scope!");
@evinism
evinism / uncomment.js
Created October 17, 2021 23:03
cjsp4
function uncomment(fn){
const body = fn.toString().replace(/\/\//, '');
return new Function(`return (${body})(...arguments)`);
}
function fn(a){
// return a + 1;
return a
}