Skip to content

Instantly share code, notes, and snippets.

Hammer Time

Terkel terkelg

Hammer Time
View GitHub Profile
sanzaru / CollapsibleDemoView.swift
Last active Aug 19, 2020
Demo view for collapsible view
View CollapsibleDemoView.swift
import SwiftUI
struct CollapsibleDemoView: View {
var body: some View {
VStack(spacing: 10) {
HStack {
Text("Here we have some fancy text content. Could be whatever you imagine.")
sanzaru / Collapsible.swift
Last active Aug 19, 2020
SwiftUI collapsible view
View Collapsible.swift
import SwiftUI
struct Collapsible<Content: View>: View {
@State var label: () -> Text
@State var content: () -> Content
@State private var collapsed: Bool = true
var body: some View {
VStack {
magnuskahr / EnumPicker.swift
Last active Jul 25, 2020
A simple picker to pick a enum.
View EnumPicker.swift
import SwiftUI
struct EnumPicker<T: Hashable & CaseIterable, V: View>: View {
@Binding var selected: T
var title: String? = nil
let mapping: (T) -> V
var body: some View {
View spline-gradient.js
global.THREE = require("three");
const canvasSketch = require('canvas-sketch');
const Random = require('canvas-sketch-util/random');
const gradientHeight = 512;
const settings = {
dimensions: [ 2048, gradientHeight * 2 ]
mattdesl / sketch.js
Created Nov 9, 2019
canvas-sketch + dat.gui
View sketch.js
const canvasSketch = require("canvas-sketch");
const { GUI } = require("dat.gui");
const data = {
background: "#de6060",
number: 0.35
const settings = {
dimensions: [2048, 2048],

Modules for Creative Coding

This workshop encourages students to make use of npm modules to build complex and interesting artworks.

If you find a module you want to use, like riso-colors, you can install it from your project folder like so:

npm install riso-colors


Interpolating between things using lerp.

function lerp (start, end, t) {
  return start * (1 - t) + end * t;
droustchev /
Last active Apr 15, 2020
tmux vim navigation

I recently tried out the fantastic vim-tmux-navigator tmux plugin. Unfortunately, some the default key bindings conflict with some of the key bindings my fuzzy finder of choice uses. I wanted to remap them to the default vim split navigation commands that are prefixed with C-w, and found the solution of hjdivad in his gist. However, I wanted a simpler solution, so after some more digging I stumbled upon this reddit post and ultimately came up with the following solution, which doesn't rely on key bindings that unbind themselves, but uses tmux's 'key-tables'.

You can’t perform that action at this time.