Skip to content

Instantly share code, notes, and snippets.

View koenbok's full-sized avatar

Koen Bok koenbok

View GitHub Profile
@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

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)
# 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 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"
# 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
<html>
<body>
<video controls autoplay muted>
<source id="mp4" src="http://grochtdreis.de/fuer-jsfiddle/video/sintel_trailer-480.mp4" type="video/mp4">
</video>
</body>
</html>
import * as React from "react";
export class Keyboard extends React.Component {
state = { key: null };
onChange = event => {
this.setState({ key: event.target.value });
};
render() {
@koenbok
koenbok / store.ts
Last active November 10, 2023 00:17
import * as React from "react";
/**
A hook to simply use state between components
Warning: this only works with function components (like any hook)
Usage:
// You can put this in an central file and import it too
const useStore = createStore({ count: 0 })
@koenbok
koenbok / TabBar.tsx
Created May 15, 2019 18:49
Tab Bar
import * as React from "react"
import { Frame, Stack } from "framer"
function capitalize(name) {
// Capitalizes a word: feed -> Feed
return name.charAt(0).toUpperCase() + name.slice(1)
}
function Button({ title, active, onTap }) {
const opacity = active ? 1 : 0.35
import * as React from "react"
import { Frame, useCycle } from "framer"
export function Button() {
const [variant, next] = useCycle({ scale: 1 }, { scale: 1.5 })
return (
<Frame
animate={variant}
onTap={() => next()}