I hereby claim:
- I am cassiel on github.
- I am cassiel (https://keybase.io/cassiel) on keybase.
- I have a public key whose fingerprint is 2A68 ADDC 2464 C81E D429 47B2 8CE5 D2B4 CEA5 0008
To claim this, I am signing this object:
| -- Testing whether we can load shado from elsewhere: | |
| local types = include("shado/lib/types") | |
| local blocks = include("shado/lib/blocks") | |
| local frames = include("shado/lib/frames") | |
| local renderers = include("shado/lib/renderers") | |
| local manager = include("shado/lib/manager") | |
| function init() | |
| local lamp_full = types.LampState.ON |
| # start coding here or load an example from the dropdown above! | |
| lp.start() | |
| gcode('M105') | |
| lp.dist(50).go(1) | |
| lp.turn(180).dist(50).go(1) | |
| lp.extrude({'e': 5, 'speed': 5}) |
I hereby claim:
To claim this, I am signing this object:
| (defn intersection-2D | |
| "Intersection of two lines in 2D space. No checks for parallel or coincident lines." | |
| [[[x1 y1] [x2 y2]] | |
| [[x3 y3] [x4 y4]]] | |
| (let [denom (- (* (- x1 x2) (- y3 y4)) | |
| (* (- y1 y2) (- x3 x4))) | |
| x1y2-y1x2 (- (* x1 y2) (* y1 x2)) | |
| x3y4-y3x4 (- (* x3 y4) (* y3 x4)) | |
| px-num (- (* x1y2-y1x2 (- x3 x4)) | |
| (* (- x1 x2) x3y4-y3x4)) |
| theNotes = [:a2, :a3, :e3, :a4, :g4, :e4] | |
| define :foo do |samp, n| | |
| sample samp, | |
| rate: pitch_ratio(note(n) - note(:a3)), | |
| sustain: 0.05, | |
| release: 0.1, | |
| amp:3 | |
| end |
| (defn paint | |
| "Paint does the work. Iterate through the circular queue of states, drawing | |
| a fat line from each point to the next (if button down)." | |
| [me] | |
| (... | |
| (letfn [(iter [i last-x last-y] | |
| ((let [{:keys [button x y]} (nth points i)] | |
| ... | |
| (.move_to g last-x last-y) | |
| (.line_to g x y) |
| (defn bucket-add | |
| "Cycle a new button/x/y into the point stash and force redraw. | |
| Unlike the original Javascript, we | |
| add to the front and remove from the end. | |
| " | |
| [me state] | |
| (let [old (.-point_stash me)] | |
| (set! (.-point_stash me) (cons state (drop-last old))) | |
| (stash me state) | |
| (.redraw (.-mgraphics me)))) |
| from java.util import Map, List | |
| class Manifest: | |
| def __init__(self, h=None, **kw): | |
| for k in kw: | |
| setattr(self, k, kw[k]) | |
| if h is not None: | |
| for k in h.iterator(): | |
| n = k.getKey().getName() |
| (defn kick | |
| [m_Configuration m_Geometry] | |
| (let [{:keys [DO_VORONOI TREE_DEPTH BRANCH_BEND_PATHS]} | |
| (u/hashify m_Configuration) | |
| {:keys [CELL_ROWS CELL_COLS CELL_SIZE DELTA | |
| INITIAL_LEN LEN_MUL]} | |
| (u/hashify m_Geometry)] | |
| (fn [t] | |
| (let [v-fn (if DO_VORONOI | |
| (voronoi-with (* CELL_COLS CELL_SIZE 1/2) |
| (ns oncotrees.util | |
| (:import [org.python.core PyFloat PyInteger PyBoolean PyString | |
| PyList PyInstance PyNone] | |
| [java.util NoSuchElementException])) | |
| (defn hashify [py-object] | |
| (cond (instance? PyNone py-object) nil | |
| (instance? PyInstance py-object) | |
| (letfn [(retr [key] (.__getitem__ (.__dict__ py-object) key)) | |
| (de-iter [iter result] |