Skip to content

Instantly share code, notes, and snippets.

Koen Bok koenbok

Block or report user

Report or block koenbok

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View TabBar.tsx
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
View store.ts
import * as React from "react";
import { useState, useEffect } from "react";
/**
A hook to simply use state between components
Usage:
// You can put this in an central file and import it too
const useStore = createStore({ count: 0 })
View keyboard.tsx
import * as React from "react";
export class Keyboard extends React.Component {
state = { key: null };
onChange = event => {
this.setState({ key: event.target.value });
};
render() {
View autoplay.html
<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>
View CanvasLayer-Fabric.coffee
# 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
View CanvasLayer.coffee
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"
View SVGLayer-Raphael.coffee
# 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"})
View SVGLayer.coffee
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 Nov 13, 2018
My Favorite Mac Tweaks
View mac-tweaks.md

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

View cotree.ts
// Internal types
interface NodeType {
id: string
type: string
attributes: Map<string, any>
children: List<NodeType>
}
You can’t perform that action at this time.