Skip to content

Instantly share code, notes, and snippets.

View avandolder's full-sized avatar

Adam Vandolder avandolder

View GitHub Profile
<!DOCTYPE html>
<script>
window.onload = () => {
navigation.onnavigateerror = () => {
navigation.navigate("#2");
};
navigation.navigate("#1");
navigation.reload();
};
</script>
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<form>
<input type="button" id="content">button</input>
</form>
<script>
let o = new MutationObserver(mutations =>
mutations.forEach(mutation => {
Building Dotty...
[info] welcome to sbt 1.5.5 (N/A Java 17)
[info] loading settings for project dotty-build-build from build.sbt ...
[info] loading project definition from /home/adam/research/dotty/project/project
[info] loading settings for project dotty-build from build.sbt,plugins.sbt ...
[info] loading project definition from /home/adam/research/dotty/project
[info] loading settings for project scala3 from build.sbt ...
[info] resolving key references (28841 settings) ...
[info] set current project to scala3 (in build file:/home/adam/research/dotty/)
[info] compiling 504 Scala sources and 6 Java sources to /home/adam/research/dotty/out/bootstrap/scala3-compiler-bootstrapped/scala-3.1.1-RC1-bin-SNAPSHOT-nonbootstrapped/classes ...
Building Dotty...
[info] welcome to sbt 1.5.5 (N/A Java 17)
[info] loading settings for project dotty-build-build-build-build from metals.sbt ...
[info] loading project definition from /home/adam/research/dotty/project/project/project/project
[info] loading settings for project dotty-build-build-build from metals.sbt ...
[info] loading project definition from /home/adam/research/dotty/project/project/project
[success] Generated .bloop/dotty-build-build-build.json
[success] Total time: 0 s, completed Nov 10, 2021, 8:57:18 AM
[info] loading settings for project dotty-build-build from build.sbt,metals.sbt ...
[info] loading project definition from /home/adam/research/dotty/project/project
(lldb) run --enable-iterator-helpers -f ~/dev/mozilla-unified/js/src/tests/non262/AsyncIterator/prototype/map/map.js
There is a running process, kill it and restart?: [Y/n] Y
Process 7953 exited with status = 9 (0x00000009)
Process 7961 launched: '/Users/avandolder/dev/mozilla-unified/build_DBG.OBJ/dist/bin/js' (x86_64)
here!
Process 7961 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001006d02a4 js`intrinsic_DumpMessage(cx=0x0000000108a34000, argc=1, vp=0x00000001092643d0) at SelfHosting.cpp:500:12
497 * Dumps a message to stderr, after stringifying it. Doesn't append a newline.
498 */
@avandolder
avandolder / iterator-helper-designs.md
Last active June 25, 2020 14:46
Potential spec designs for Iterator Helper generator objects

Two different ways of spec'ing built-in generators. I believe the difference is between them is purely editoral:

  1. Copy entire existing 25.4 Generator Objects section of the spec, changing the name to, say, BuiltinGenerator Objects that have no prototype and modified abstract operations, so they are observably distinct from generators, while behaving the same. Then make the lazy Iterator Helper methods create and return new objects that contain instances of these internal generators with the proper function bodies.

    Duplicates a lot of stuff in the spec, but seems pretty straightforward to write and understand.

  2. Create some kind of AbstractGenerator/AbstractAsyncGenerator interfaces and move as much of the abstract operations

@avandolder
avandolder / got_battle.py
Created May 17, 2019 23:20
Probability simulation for 538's Riddler Classic on 2019-05-17
import random
BATTLES = 20000
def battle(usize, lsize):
while usize > 0 and lsize > 0:
winner = random.randrange(2)
if winner == 0:
usize += 1
lsize -= 1
abbr = {
'at': '@',
'and': '&',
'one': '1',
'won': '1',
'to': '2',
'too': '2',
'two': '2',
'for': '4',
'four': '4',
@avandolder
avandolder / riddler_classic_2019-02-08.py
Created February 8, 2019 19:15
Basic program to generate all card combinations for 538's Riddler classic (https://fivethirtyeight.com/features/525600-minutes-of-math/)
def combos(s, n, l, used):
for i in range(n, 0, -1):
if i not in used and s+i <= 15:
l.append([i])
combos(s+i, i, l[-1], used | {i})
if len(l[-1]) == 1 and s+i != 15:
del l[-1]
l = []
combos(0, 9, l, set())
@avandolder
avandolder / first-missing-positive.cpp
Created January 24, 2019 15:38
Solution to first-missing-positive on leetcode
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
const int n = nums.size();
for (int i = 0; i < n; i++) {
if (nums[i] > 0 && nums[i] <= n && nums[i] != i + 1) {
int next = nums[nums[i] - 1], t = nums[i];
while (t > 0 && t <= n && next != t) {