Skip to content

Instantly share code, notes, and snippets.

@boustrophedon
boustrophedon / hanoi.py
Last active July 29, 2019 00:09
Use hypothesis to solve towers of hanoi
from typing import Optional, Tuple, List
class Hanoi:
def __init__(self, num_rings: int):
self.num_rings = num_rings
if num_rings < 1:
raise ValueError("Number of rings must be at least 1.")
self.pegs: List[List[int]] = [list(), list(), list()]
self.pegs[0] = list(reversed(range(0, num_rings)))
@boustrophedon
boustrophedon / index.html
Created March 6, 2019 23:27
mouse-controlled quadratic
<canvas/>
@boustrophedon
boustrophedon / index.html
Last active March 7, 2019 21:11
animated quadratic
<canvas/>
pub fn cross2d<T>(a: &[T;2], b: &[T;2], c: &[T;2]) -> T where
for<'a> &'a T: RefNum<T>,
T: Num {
return (&b[0]-&a[0]) * (&c[1]-&a[1]) - (&b[1]-&a[1]) * (&c[0]-&a[0]);
}
@boustrophedon
boustrophedon / output.txt
Last active May 15, 2018 11:19
reftests with empty batches
168-REFTEST reftests/border/border-double-simple.yaml == reftests/border/border-double-simple-ref.yaml
169: WARN 2018-05-15T11:26:53Z: webrender::renderer: draw_instanced_batch: batch is empty
170-REFTEST reftests/border/border-double-simple-2.yaml == reftests/border/border-double-simple-2-ref.yaml
171: WARN 2018-05-15T11:26:53Z: webrender::renderer: draw_instanced_batch: batch is empty
--
175-REFTEST reftests/border/border-image.yaml == reftests/border/border-image-ref.png
176: WARN 2018-05-15T11:26:54Z: webrender::renderer: draw_instanced_batch: batch is empty
177-REFTEST reftests/border/border-image-crash.yaml == reftests/border/border-image-crash-ref.yaml
178: WARN 2018-05-15T11:26:54Z: webrender::renderer: draw_instanced_batch: batch is empty
179: WARN 2018-05-15T11:26:54Z: webrender::renderer: draw_instanced_batch: batch is empty
@boustrophedon
boustrophedon / output.txt
Created May 11, 2018 21:50
webrender reftest failures on headless
$ git log | head -1
commit 5b83a1bc284b59c7672fb840266465c73ea6d99c
$ script/headless.py reftest
[...]
REFTEST INFO | 270 passing, 11 failing
Reftests with unexpected results:
reftests/text/colors.yaml == reftests/text/colors-subpx.png
reftests/text/colors.yaml == reftests/text/colors-subpx.png
reftests/text/border-radius.yaml == reftests/text/border-radius-subpx.png
Compiling libc v0.2.40
Compiling cfg-if v0.1.2
Compiling byteorder v1.2.2
Compiling nodrop v0.1.12
Compiling memoffset v0.2.1
Compiling lazy_static v1.0.0
Compiling slab v0.4.0
Compiling futures v0.1.20
Compiling scopeguard v0.3.3
Compiling lazycell v0.6.0
@boustrophedon
boustrophedon / vartest.cpp
Last active April 4, 2018 00:40
g++ -std=c++17 vartest.cpp -o vartest && ./vartest; echo $?
#include <variant>
#include <string>
#include <cassert>
using std::string;
int main() {
std::variant<bool, string> v = "hello";
try {
@boustrophedon
boustrophedon / output
Created August 18, 2017 23:39
Warnings and errors from flutter analyze
Analyzing 1157 files...
[warning] The method 'encodePng' isn't defined for the class 'Upload'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 83, col 20)
[warning] The method 'decodePng' isn't defined for the class 'Upload'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 83, col 41)
[warning] The method 'copyResize' isn't defined for the class 'Upload'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 83, col 30)
[error] Target of URI doesn't exist: 'package:image/image.dart'. (/home/hcs/code/flutter/dev/devicelab/lib/tasks/save_catalog_screenshots.dart, line 10, col 8)
[lint] 1 public member lacks documentation (ran in 29.5s)
@boustrophedon
boustrophedon / assertion_failure.dart
Created August 18, 2017 23:35
Assertion failure in gesture handling
I/flutter (23776): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter (23776): The following assertion was thrown while handling a gesture:
I/flutter (23776): 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 425: '_hold != null': is not
I/flutter (23776): true.
I/flutter (23776):
I/flutter (23776): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (23776): more information in this error message to help you determine and fix the underlying cause.
I/flutter (23776): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (23776): https://github.com/flutter/flutter/issues/new
I/flutter (23776):