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
// | |
// Diagrams.swift | |
// DiagramsSample | |
// | |
// Created by Chris Eidhof on 16.12.19. | |
// Copyright © 2019 objc.io. All rights reserved. | |
// | |
import SwiftUI |
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
import PlaygroundSupport | |
import Foundation | |
struct Resource<A> { | |
var request: URLRequest | |
var parse: (Data) throws -> A | |
} | |
protocol Loadable { | |
static var request: URLRequest { get } |
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
import UIKit | |
typealias Constraint = (UIView, UIView) -> NSLayoutConstraint | |
func equal<L, Axis>(_ to: KeyPath<UIView, L>, constant: CGFloat = 0) -> Constraint where L: NSLayoutAnchor<Axis> { | |
return equal(to, to, constant: constant) | |
} | |
func equal<L, Axis>(_ from: KeyPath<UIView, L>, _ to: KeyPath<UIView, L>, constant: CGFloat = 0) -> Constraint where L: NSLayoutAnchor<Axis> { | |
return { view1, view2 in |
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
import Cocoa | |
public final class PropertiesDecoder: Decoder { | |
static func decode<T: Decodable>(_ type: T.Type) throws -> [String] { | |
let d = PropertiesDecoder() | |
_ = try T(from: d) | |
return d.fields | |
} | |
public var codingPath: [CodingKey] { return [] } |
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
// gem install cocoapods-playgrounds | |
// pod playgrounds LibYAML | |
// Paste in the following: | |
import LibYAML | |
struct YAMLError: ErrorType { | |
let problem: String | |
let problemOffset: Int |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>congratulate %@ to %d(his/her) birthday</key> | |
<dict> | |
<key>NSStringLocalizedFormatKey</key> | |
<string>Congratulate %@ to %#@pronoun@ birthday</string> | |
<key>pronoun</key> | |
<dict> |
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
NSURLConnection | NSURLSession | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connectionShouldUseCredentialStorage: | | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler: | |
| N |
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
In order for this to work you need ffmpeg. I tried with version 1.2.1. | |
1) Play the video you want to download in the browser | |
2) Inspect the video element on the page | |
3) Copy the video url from the page source (something like http://devstreaming.apple.com/videos/wwdc/2013/.../101/ref.mov) | |
4) In this url replace "ref.mov" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?) | |
5) Execute `ffmpeg -y -i http://devstreaming.apple.com/videos/wwdc/2013/.../101/iphone_c.m3u8 output.mp4` | |
6) There is your video :) |
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
// buildfile.js ----------------------------------------- | |
var garcon = require('garcon'); | |
var SproutCore = require('frameworks/sproutcore/buildfile'); | |
module.exports = MyProject; | |
var MyProject = garcon.Project.extend({ |
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
var tools = require('../tools'); | |
var Handler = require("./handler").Handler; | |
var Join, HandlerSet; | |
Join = Handler.extend({ | |
data: null, | |
handle: function(file,request,callback){ |