Skip to content

Instantly share code, notes, and snippets.

Peter van der Zee pvdz

Block or report user

Report or block pvdz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pvdz
pvdz / submoduiles.js
Created Sep 24, 2017
Silly mocha+babel problem with relative imports outside project root
View submoduiles.js
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 / verifier.js
Created Aug 24, 2017
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…
View verifier.js
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 Aug 24, 2017
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…
View verifier.js
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 Aug 24, 2017
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…
View verifier.js
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';
View path.txt
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 / build.js
Last active Dec 9, 2016
failing babili on this finitedomain build at bbc7aeecd2b1fee7409d8ddd46e8f78091bcaaaf (grunt distq, ./node_modules/.bin/babili build/finitedomain.es6.concat.js -o foo.js)
View build.js
let Solver = (function(){
// from: src/config.js
/**
* @returns {$config}
*/
function config_create() {
let config = {
@pvdz
pvdz / gist:26473dd35c9ebd04d8a089fc0cd319d3
Created Aug 20, 2016
mass steam confirmation clicking in gmail (through console)
View gist:26473dd35c9ebd04d8a089fc0cd319d3
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 / txt
Last active Dec 2, 2015
Raw isaac point data
View txt
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:3bbe2333fadda54da93f
Created Jul 2, 2015
get randomly reordered 1234 (or abcd) without using arrays
View gist:3bbe2333fadda54da93f
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 / gist:3cccc4f36c8319e09bb7
Created Jan 29, 2015
JS1k 2015 bare shim. This is loaded in an iframe dynamically. You can opt for an empty DOM during submit, a 2d canvas, or a webgl canvas. You can also specify max canvas width/height during submit, defaults to 100%. If empty, `a`, `c`, and `g` will obviously not exist. `top.reload()` replaces the iframe containing your demo with a new instance, …
View gist:3cccc4f36c8319e09bb7
<!doctype html>
<html style="margin: 0; padding: 0; border: 0; width: 100%; height: 100%;">
<head>
<meta charset="utf-8">
</head>
<body style="margin: 0; padding: 0; border: 0; width: 100%; height: 100%;">
<canvas style="display: block; width: WIDTHpx; height: HEIGHTpx;" width="WIDTH" height="HEIGHT"></canvas>
<script>
// shim...
var a = canvas;
You can’t perform that action at this time.