Skip to content

Instantly share code, notes, and snippets.

Avatar

Dominique d'Argent nubbel

View GitHub Profile
@nubbel
nubbel / Context.swift
Created Nov 2, 2017
Apollo-Link Context
View Context.swift
//: 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
View Observable.swift
//: 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 Aug 28, 2017 — forked from dabrahams/AnyComparable.swift
Faux Equatable and Comparable Existentials
View AnyComparable.swift
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 Jun 9, 2017 — forked from ddunbar/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks
View xcbuild-debugging-tricks.md

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
View hostname dhclient hook
#!/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
View model_export.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View random_persons.csv
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
View ConfigurationClosure.swift
struct Manager {
final class Configuration {
var name: String = "default"
var timeout: Double = 500
}
private let configuration: Configuration
var name: String {
return configuration.name
View EnumIterator.swift
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 Jul 21, 2016
Enables diffing Xcode Provisioning Profiles
View .gitattributes
*.mobileprovision diff=provisioningprofile
*.provisionprofile diff=provisioningprofile
You can’t perform that action at this time.