Skip to content

Instantly share code, notes, and snippets.

@arccoza
arccoza / callable-object-constructor.js
Last active March 6, 2023 21:38
Javascript Callable Object Class / Constructor created by arccoza - https://repl.it/EbN5/18
// This is my approach to creating callable objects
// that correctly reference their object members,
// without messing with prototypes.
// A Class that extends Function so we can create
// objects that also behave like functions, i.e. callable objects.
class ExFunc extends Function {
constructor() {
// Here we create a dynamic function with `super`,
// which calls the constructor of the parent class, `Function`.
@arccoza
arccoza / sierpinski_triangle.py
Created November 9, 2016 05:22
The Sierpinski triangle fractal in python with turtle.
from turtle import Screen, Turtle, mode, Vec2D
win = Screen()
win.bgcolor('black')
mode('logo')
tur = Turtle()
tur.shape('arrow')
tur.shapesize(0.5, 0.5, 0.5)
tur.color('lime', 'green')