socat -d -d TCP4-LISTEN:15432,fork UNIX-CONNECT:/srv/mongodb-27017.sock
./forward-port-to-socket.sh 15432 /srv/mongodb-27017.sock
from __future__ import print_function | |
import argparse | |
import os | |
import sys | |
import time | |
import jwt | |
def configure_with(args): | |
iss = args.iss |
public protocol CellRegistration: class { | |
static var reuseIdentifier: String { get } | |
} | |
extension CellRegistration where Self: UIView { | |
public static var reuseIdentifier: String { | |
return String(describing: self) | |
} | |
} |
require "SimpleMDM" | |
module Fastlane | |
module Actions | |
module SharedValues | |
end | |
class UploadToSimplemdmAction < Action | |
def self.run(params) | |
SimpleMDM.api_key = "#{params[:api_key]}" |
A number of tech news outlets, including WIRED, GigaOm, and MIT Technology Review, have recently started writing about Multipeer Connectivity ("one weird trick that the NSA hates"). Since the NSHipster article on the subject has been linked to in a lot of this coverage, I wanted to share some additional thoughts on the matter:
Multipeer Connectivity(http://nshipster.com/multipeer-connectivity/) represents a significant shift in the opposite direction of how we conventionally think about mobile applications. Nearly every app on your phone operates in a client-server model, with the device making requests to remote cloud services to send and receive messages, photos, and videos. The [
extension NSObjectProtocol where Self: NSObject { | |
func observe<Value>(_ keyPath: KeyPath<Self, Value>, onChange: @escaping (Value) -> ()) -> NSKeyValueObservation { | |
return observe(keyPath, options: [.initial, .new]) { _, change in | |
// TODO: change.newValue should never be `nil`, but when observing an optional property that's set to `nil`, then change.newValue is `nil` instead of `Optional(nil)`. This is the bug report for this: https://bugs.swift.org/browse/SR-6066 | |
guard let newValue = change.newValue else { return } | |
onChange(newValue) | |
} | |
} | |
func bind<Value, Target>(_ sourceKeyPath: KeyPath<Self, Value>, to target: Target, at targetKeyPath: ReferenceWritableKeyPath<Target, Value>) -> NSKeyValueObservation { |
// | |
// Created by ddrccw on 14-1-10. | |
// Copyright (c) 2014年 ddrccw. All rights reserved. | |
// refer to http://danqingdani.blog.163.com/blog/static/1860941952012102122847478/ | |
#import <sys/stat.h> | |
#import <mach-o/dyld.h> | |
//#import <stdlib.h> | |
//#import <string.h> |
struct LoadInput<T, U> { | |
let trigger: Observable<T> /// will cause the network request to start passing the T to the request generator. | |
let makeRequest: (T) -> URLRequest /// a function that knows how to create the URLRequest | |
let download: (URLRequest) -> Observable<Data> /// the function that actually does the download. By default, it uses URLSession.shared | |
let makeObject: (Data) -> U /// a function that knows how to convert the data into the needed resource. | |
} | |
extension LoadInput { | |
init(trigger: Observable<T>, makeRequest: @escaping (T) -> URLRequest, makeObject: @escaping (Data) -> U) { | |
self.trigger = trigger |
public extension Decodable { | |
static func randomInstance() throws -> Self { | |
let decoder = _RandomDecoder() | |
return try Self(from: decoder) | |
} | |
} | |
public class RandomDecoder { | |
public func decode<T: Decodable>(_: T.Type) throws -> T { | |
let decoder = _RandomDecoder() |