# enable internal menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -book YES
alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SegmentedControl.swift | |
// | |
// Created by Dominique d'Argent on 15/06/15. | |
// Copyright © 2015 Dominique d'Argent. All rights reserved. | |
// | |
import UIKit | |
@IBDesignable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol ArrayRepresentable { | |
typealias ArrayType | |
func toArray() -> ArrayType[] | |
} | |
extension Range : ArrayRepresentable { | |
func toArray() -> T[] { | |
return T[](self) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func encode<T>(var value: T) -> NSData { | |
return withUnsafePointer(&value) { p in | |
NSData(bytes: p, length: sizeofValue(value)) | |
} | |
} | |
func decode<T>(data: NSData) -> T { | |
let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type)) | |
data.getBytes(pointer) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct TakeSequenceView<Base : SequenceType> : SequenceType { | |
let base: Base | |
let n: Int | |
init(_ base: Base, n: Int) { | |
self.base = base | |
self.n = n | |
} | |
func generate() -> GeneratorOf<Base.Generator.Element> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GooglePlayVerification | |
require 'google/api_client' | |
# Refer: | |
# https://code.google.com/p/google-api-ruby-client/issues/detail?id=72 | |
# and | |
# http://jonathanotto.com/blog/google_oauth2_api_quick_tutorial.html | |
# and | |
# http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/ | |
GOOGLE_KEY = 'xxx-xxx.apps.googleusercontent.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Foundation | |
protocol ObserverType { | |
associatedtype Element | |
func onNext(_ element: Element) | |
func onComplete() | |
func onError(_ error: Error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: 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 |
NewerOlder