Skip to content

Instantly share code, notes, and snippets.

View koenbok's full-sized avatar

Koen Bok koenbok

View GitHub Profile
# Don't forget to add Frabric to the index.html file
# https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.7.2/fabric.js
layer = new CanvasLayer
# Create a new Fabric canvas instance
canvas = new fabric.Canvas(layer.canvas)
rect = new fabric.Circle
radius: 100
layer = new CanvasLayer
point: Align.center
layer.ctx.beginPath()
layer.ctx.arc(100, 100, 90, 0, 2 * Math.PI, true)
layer.ctx.fillStyle = "#0055DD"
layer.ctx.fill()
layer.ctx.lineWidth = 20
layer.ctx.strokeStyle = "#00AAFF"
# Make sure Raphael.js is included in the html file
layer = new CanvasLayer
paper = new Raphael(layer.svg)
text = paper.text(70, 40, "Lorem Ipsum!")
text.attr({"font-size": 20, "fill": "orange"})
layer = new SVGLayer
point: Align.center
shape = layer.addShape("circle")
shape.setAttribute("cx", 100)
shape.setAttribute("cy", 100)
shape.setAttribute("r", 90)
shape.setAttribute("fill", "#0055DD")
shape.setAttribute("stroke", "#00AAFF")
shape.setAttribute("stroke-width", 20)
@koenbok
koenbok / mac-tweaks.md
Last active April 23, 2022 22:37
My Favorite Mac Tweaks

Skip verifying disk images

defaults write com.apple.frameworks.diskimages skip-verify true

Always hide the Desktop

defaults write com.apple.finder CreateDesktop false; killall Finder

Make terminal logins fast

touch ~/.hushlogin

Disable most animations

// Internal types
interface NodeType {
id: string
type: string
attributes: Map<string, any>
children: List<NodeType>
}
interface Node {
id: string
type: string
children: List<Node>
}
class Tree {
// Create and remove (updates root)
create(type: string, parent: string|null|Node= null, attributes: any = {}): Node {}
layer = new Layer
# Hello Jordan!
@koenbok
koenbok / Makefile
Created February 13, 2016 11:36
Updating subprojects in Makefiles
# Preferred way to deal with subprojects, because we want to avoid submodules.
# This way we do everything explicitly, and can verify everything in commits.
# We need to always keep master in good condition.
TMP = ./tmp
PROJECT_TEMP = $(TMP)/FramerSketch
PROJECT_GIT = git@github.com:motif/FramerSketch2.git
update%project:
@mkdir -p $(TMP)