The perfect test is concise, unambiguous, safe, with easily understandable logging.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Untested. Requires Prototype >= 1.6 | |
// | |
// Copyright (c) 2009 Tobie Langel | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* round("M -0.09375,-3 A 1.001098,1.001098 0 1 0 0,-1 C 0.56412939,-1 1,-0.56412939 1,0 1,0.27245181 0.8799664,0.4950336 0.6875,0.6875 A 1.016466,1.016466 0 1 0 2.125,2.125 C 2.6563912,1.5936088 3,0.83211769 3,0 3,-1.6450096 1.6450096,-3 0,-3 a 1.0001,1.0001 0 0 0 -0.09375,0 z") | |
=> "M -0.1,-3 A 1,1 0 1 0 0,-1 C 0.6,-1 1,-0.6 1,0 1,0.3 0.9,0.5 0.7,0.7 A 1,1 0 1 0 2.1,2.1 C 2.7,1.6 3,0.8 3,0 3,-1.6 1.6,-3 0,-3 a 1,1 0 0 0 -0.1,0 z" | |
*/ | |
function round (path) { | |
return path.replace(/[\d\.-][\d\.e-]*/g, function(n){return Math.round(n*10)/10}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this regular expression detects most of the Inkscape markup in an SVG which can be safely removed for delivery to a browser | |
(style|(inkscape|sodipodi):[^=]+)="[^"]*"|id="(path|rect|layer|defs|g)[\d-]+" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {setTimeout} from 'node:timers/promises'; | |
const root2 = 2**0.5; | |
const circ = (r) => { | |
const rr = Math.round(r); | |
const buff = Array(rr*2+1).fill(0).map(_ => (Array(rr*2+1).fill(' '))); |