Skip to content

Instantly share code, notes, and snippets.

Amber Star amberstar

Block or report user

Report or block amberstar

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
amberstar / PiP
Created Jun 14, 2019
Javascript to make video on current page PiP
View PiP
View Copyable.swift
protocol Copyable {
typealias CopyType
func copy() -> CopyType
class A: Copyable {
var x: Int
init(x: Int) { self.x = x }
func copy() -> A {
amberstar /
Last active Feb 1, 2018 — forked from felix-schwarz/
Updated script that builds OpenSSL for OS X, iOS and tvOS. Bitcode enabled for iOS, tvOS. Updated to build for tvOS, use the latest SDKs, skip installing man pages (to save time), download the OpenSSL source over HTTPS, patch OpenSSL for tvOS to not use fork(). Currently requires Xcode7.1b or later (for the tvOS SDK).
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# Peter Steinberger, PSPDFKit GmbH, @steipete.
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz.
amberstar / Dispatcher_Sensor.swift
Last active Dec 11, 2016
Trigger updates via. property observer
View Dispatcher_Sensor.swift
// embed in the target (note props are read only)
protocol MySensor {
var name: String { get }
var age: Int { get }
// an example target that holds sensor
protocol MyView {
var sensor: MySensor { get set }
amberstar / ModifyBehavior.swift
Created Dec 2, 2016
Modify behavior of struct
View ModifyBehavior.swift
struct ModifyBehavior {
var value: Int
static var operation1: (inout ModifyBehavior) -> Int = { instance in
instance._operationToUse = operation2
return instance.value
static var operation2: (inout ModifyBehavior) -> Int = { instance in
instance.value = 0;
View ResponderChainExample.swift
// events
public struct ComponentEvents {
public var appEvent = Port<(component: Component, event: EventType)>()
} { component, event in
self.applicationEvent(component, event: event)
func applicationEvent(component: Component, event: Event) {
View Counter-2.swift
//: [Previous](@previous)
import UIKit
import Behavior
import XCPlayground
//: ## Task: Create a small counter application
//: This approach uses ports and behaviors
struct Counter {
You can’t perform that action at this time.