Skip to content

Instantly share code, notes, and snippets.

View henkvanderspek's full-sized avatar

Henk van der Spek henkvanderspek

  • Almere, The Netherlands
View GitHub Profile
@henkvanderspek
henkvanderspek / index.html
Last active April 5, 2023 21:29 — forked from chalin/main.dart
Language Tour: Anonymous Function
Blaat
import { useEffect } from "react"
import * as _ from "https://jspm.dev/react-ace"
export default function TestComponent() {
useEffect(() => {
const editor = ace.edit("foo")
editor.setTheme("ace/theme/monokai")
editor.session.setMode("ace/mode/javascript")
})
return <div id="foo"></div>
@henkvanderspek
henkvanderspek / lbForth.c
Created April 11, 2020 21:13 — forked from lbruder/lbForth.c
A minimal Forth compiler in ANSI C
/*******************************************************************************
*
* A minimal Forth compiler in C
* By Leif Bruder <leifbruder@gmail.com> http://defineanswer42.wordpress.com
* Release 2014-04-04
*
* Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial
*
* PUBLIC DOMAIN
*
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
@implementation NSObject (BadAssSwizzle)
+ (void)load {
SEL originalSelector = @selector(init);
SEL overrideSelector = @selector(myInit);
Method originalMethod = class_getInstanceMethod(self, originalSelector);
Method overrideMethod = class_getInstanceMethod(self, overrideSelector);
@henkvanderspek
henkvanderspek / Reusable.swift
Last active October 16, 2018 15:38
Cell dequeueing: Can it be so simple? Yes, it can :)
protocol Reusable {
associatedtype T
static var cellReuseIdentifier: String { get }
static var nib: UINib { get }
static func register(for tableView: UITableView)
static func register(for collectionView: UICollectionView)
static func registerSectionHeaderView(for collectionView: UICollectionView)
static func registerSectionFooterView(for collectionView: UICollectionView)
static func dequeue<T>(for tableView: UITableView, at indexPath: IndexPath) -> T
static func dequeue<T>(for tableView: UICollectionView, at indexPath: IndexPath) -> T