Skip to content

Instantly share code, notes, and snippets.

View nubbel's full-sized avatar

Dominique d'Argent nubbel

View GitHub Profile
@nubbel
nubbel / Context.swift
Created November 2, 2017 22:18
Apollo-Link Context
//: Playground - noun: a place where people can play
import Foundation
public struct ContextKey<Value> {
public let name: String
public let defaultValue: () -> Value
public init(_ name: String, default defaultValue: @escaping @autoclosure () -> Value) {
self.name = name
//: Playground - noun: a place where people can play
import Foundation
protocol ObserverType {
associatedtype Element
func onNext(_ element: Element)
func onComplete()
func onError(_ error: Error)
@nubbel
nubbel / AnyComparable.swift
Last active August 28, 2017 07:33 — forked from dabrahams/AnyComparable.swift
Faux Equatable and Comparable Existentials
fileprivate class AnyEquatableBase {
func isEqual(to other: AnyEquatableBase) -> Bool {
fatalError("isEqual(to:) must be overridden in subclass")
}
}
fileprivate final class AnyEquatableBox<T: Equatable> : AnyEquatableBase {
private let value: T
init(_ value: T) {
@nubbel
nubbel / xcbuild-debugging-tricks.md
Created June 9, 2017 08:36 — forked from ddunbar/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks

New Build System Tricks

Command Line

# enable internal menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -book YES

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
#!/bin/sh
# dhclient change hostname script for Ubuntu
# /etc/dhcp/dhclient-exit-hooks.d/sethostname
# logs in /var/log/upstart/network-interface-eth0.log
set -x
export
if [ "$reason" = "BOUND" ] || [ "$reason" = "RENEW" ] || [ "$reason" = "REBIND" ] || [ "$reason" = "REBOOT" ]; then
echo new_ip_address=$new_ip_address
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
id first_name last_name email
1 Ara Hackett ara.hackett@example.com
2 Marco Champlin champlin.marco@example.org
3 Martin Rogahn rogahn_martin@example.net
4 Marcos Turcotte turcotte.marcos@example.net
5 Jedediah Yundt yundt_jedediah@example.org
6 Vivien Schroeder schroeder.vivien@example.net
7 Leopold Cartwright leopold_cartwright@example.net
8 Euna Ernser ernser_euna@example.com
9 Rhianna Feeney rhianna_feeney@example.net
struct Manager {
final class Configuration {
var name: String = "default"
var timeout: Double = 500
}
private let configuration: Configuration
var name: String {
return configuration.name
extension RawRepresentable where RawValue == Int {
static func enumerate() -> Self {
return self.init(rawValue: 0)!
}
static func makeIterator() -> AnyIterator<Self> {
var index = 0
return AnyIterator {
let value = Self.init(rawValue: index)
@nubbel
nubbel / .gitattributes
Created July 21, 2016 12:09
Enables diffing Xcode Provisioning Profiles
*.mobileprovision diff=provisioningprofile
*.provisionprofile diff=provisioningprofile