Skip to content

Instantly share code, notes, and snippets.

View avaidyam's full-sized avatar

Aditya Vaidyam avaidyam

View GitHub Profile
@avaidyam
avaidyam / Binding.swift
Last active June 28, 2017 10:09
A test of a KVO-based bindings replacement.
import Foundation
/// A `Binding` connects two objects' properties such that if one object's property
/// value were to ever update, the other object's property value would do so as well.
/// Thus, both objects' properties are kept in sync. The objects and their properties
/// need not be the same, however, their individual properties' types must be the same.
public class Binding<T: NSObject, U: NSObject, X, Y> {
/// Describes the initial state the `Binding` should follow. That is, upon creation
/// whether to set the "left hand side" object's value to the "right hand side"'s
@avaidyam
avaidyam / daemon.sh
Created December 27, 2016 02:22
Daemonize any tool!
#!/bin/bash
# modify this command to select what tool to daemonize.
CMD=top
# daemonizer:
case "$1" in
start) # start daemon
if [ -e "daemon.lock" ];