Skip to content

Instantly share code, notes, and snippets.

View pvdz's full-sized avatar

Peter van der Zee pvdz

View GitHub Profile
@pvdz
pvdz / gist:3bbe2333fadda54da93f
Created July 2, 2015 07:52
get randomly reordered 1234 (or abcd) without using arrays
var a = 'a', b = 'b', c = 'c', d = 'd';
a = 'a';
var r = RANDOM();
if (r < .5) {
b = a;
a = 'b';
}
r = RANDOM();
if (r < .33) {
c = b;
@pvdz
pvdz / txt
Last active December 2, 2015 22:11
Raw isaac point data
Raw data for https://www.reddit.com/r/bindingofisaac/comments/3v79hc/daily_run_point_breakdown_first_floor/
Floor layout: http://imgur.com/OjdfFC1 (crawl space in room above shop, top right rock).
Run as lazarus, starts this run with an explosive pill. when he dies he gets Anemic, may offset certain scores as well.
stage bonus:
- 500 per floor
- dice 5 room does not count
-- (TBD) probably forgetmenow neither
@pvdz
pvdz / gist:26473dd35c9ebd04d8a089fc0cd319d3
Created August 20, 2016 07:33
mass steam confirmation clicking in gmail (through console)
var e = document.createElement('div');
e.innerHTML = Array.from(document.body.querySelectorAll('a[href^="https://steamcommunity.com/market/confirmlisting/"]'))
.filter(e => e.href.indexOf('cancel') < 0)
.map(e => '<a href="'+e.href+'" onclick="p=this.parentNode;p.removeChild(this.nextElementSibling);p.removeChild(this);if(!p.children.length)p.parentNode.removeChild(p);">'+e.href+'</a><br>')
.join('\n');
document.body.appendChild(e);
e.style.position = 'absolute';
e.style.top = 0;
e.style.backgroundColor='white';
e.style.border='1px solid black';
@pvdz
pvdz / build.js
Last active December 9, 2016 11:08
failing babili on this finitedomain build at bbc7aeecd2b1fee7409d8ddd46e8f78091bcaaaf (grunt distq, ./node_modules/.bin/babili build/finitedomain.es6.concat.js -o foo.js)
let Solver = (function(){
// from: src/config.js
/**
* @returns {$config}
*/
function config_create() {
let config = {
Statement -> ExpressionStatement -> Expression -> AssignmentExpression ->
AssignmentExpression -> ConditionalExpression -> LogicalORExpression -> LogicalANDExpression ->
BitwiseORExpression -> BitwiseXORExpression -> BitwiseANDExpression -> EqualityExpression ->
RelationalExpression -> ShiftExpression -> AdditiveExpression -> MultiplicativeExpression
MultiplicativeExpression -> MultiplicativeExpression MultiplicativeOperator ExponentiationExpression
MultiplicativeOperator -> one of * / %
// We can match * on MultiplicativeOperator, continue left and right up to PrimaryExpression
// proceeding to match the arrow on the right side
ExponentiationExpression -> UnaryExpression -> UpdateExpression -> LeftHandSideExpression -> NewExpression ->
@pvdz
pvdz / verifier.js
Created August 24, 2017 17:12
This takes an fdq input problem, solves it, and confirms the result is correct. I use it to test whether transformation tricks are valid, where I don't care about the actual results as long as they are valid. This will automate this process, prevent me from having to write a zillion results by hand, and of course maintain them as they can change…
import Solver from '../../src/solver';
import {
domain__debug,
domain_arrToSmallest,
domain_createValue,
domain_divby,
domain_intersection,
domain_mul,
} from '../../src/domain';
import domain_plus from '../../src/doms/domain_plus';
@pvdz
pvdz / verifier.js
Created August 24, 2017 17:12
This takes an fdq input problem, solves it, and confirms the result is correct. I use it to test whether transformation tricks are valid, where I don't care about the actual results as long as they are valid. This will automate this process, prevent me from having to write a zillion results by hand, and of course maintain them as they can change…
import Solver from '../../src/solver';
import {
domain__debug,
domain_arrToSmallest,
domain_createValue,
domain_divby,
domain_intersection,
domain_mul,
} from '../../src/domain';
import domain_plus from '../../src/doms/domain_plus';
@pvdz
pvdz / verifier.js
Created August 24, 2017 17:12
This takes an fdq input problem, solves it, and confirms the result is correct. I use it to test whether transformation tricks are valid, where I don't care about the actual results as long as they are valid. This will automate this process, prevent me from having to write a zillion results by hand, and of course maintain them as they can change…
import Solver from '../../src/solver';
import {
domain__debug,
domain_arrToSmallest,
domain_createValue,
domain_divby,
domain_intersection,
domain_mul,
} from '../../src/domain';
import domain_plus from '../../src/doms/domain_plus';
@pvdz
pvdz / submoduiles.js
Created September 24, 2017 08:54
Silly mocha+babel problem with relative imports outside project root
How do you mocha+babel test projectA as is?
Note that projectB also its own mocha+babel tests which run fine (but they do not need to run here).
// ..../somedir/projectA/src/index.js
import {x} from '../../projectB/src/index.js';
...
// ..../somedir/projectB/src/index.js
import {x} from './tools.js';
@pvdz
pvdz / gist:a26acfde5bf309b8a0717ba2dd9250e4
Created January 28, 2020 10:07
daneden plain yarn cold
😶 11:04:20 (master) ~/gatsby/daneden.me $ gatsby build
success open and validate gatsby-configs - 0.154s
success load plugins - 0.603s
success onPreInit - 0.003s
success delete html and css files from previous builds - 0.011s
success initialize cache - 0.008s
success copy gatsby files - 0.021s
success onPreBootstrap - 0.016s
success createSchemaCustomization - 0.002s
warn code block or inline code language not specified in markdown. applying generic code block