Skip to content

Instantly share code, notes, and snippets.

var tools = require('../tools');
var Handler = require("./handler").Handler;
var Join, HandlerSet;
Join = Handler.extend({
data: null,
handle: function(file,request,callback){
@floriankugler
floriankugler / gist:1483323
Created December 15, 2011 22:49
garcon build definition
// buildfile.js -----------------------------------------
var garcon = require('garcon');
var SproutCore = require('frameworks/sproutcore/buildfile');
module.exports = MyProject;
var MyProject = garcon.Project.extend({
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 :)
@floriankugler
floriankugler / gist:6870499
Last active September 29, 2023 15:56
Mapping of NSURLConnection to NSURLSession delegate methods. Created by Mattt Thompson.
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
@floriankugler
floriankugler / gist:8767926
Created February 2, 2014 12:49
NSStringGenderRuleType example
<?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>
// gem install cocoapods-playgrounds
// pod playgrounds LibYAML
// Paste in the following:
import LibYAML
struct YAMLError: ErrorType {
let problem: String
let problemOffset: Int
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 [] }
@floriankugler
floriankugler / AutoLayoutHelpers.swift
Last active August 30, 2023 21:17
Very simple key path based Auto Layout helpers
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
import PlaygroundSupport
import Foundation
struct Resource<A> {
var request: URLRequest
var parse: (Data) throws -> A
}
protocol Loadable {
static var request: URLRequest { get }
//
// Diagrams.swift
// DiagramsSample
//
// Created by Chris Eidhof on 16.12.19.
// Copyright © 2019 objc.io. All rights reserved.
//
import SwiftUI