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
let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
/// Fetch data | |
}) |
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
let begin = request.hasByteRaange ? request.byteRange.lowerBound : 0 | |
let end = request.hasByteRaange ? request.byteRange.higherBound : clipFileSize | |
var readHead = begin | |
let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
if readHead < end { | |
let data = getData(readHead, chunkSize) | |
block(data, nil) | |
readHead += data.count | |
} else { | |
block(nil, nil) |
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
let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
let begin = request.hasByteRaange ? request.byteRange.lowerBound : 0 | |
let end = request.hasByteRaange ? request.byteRange.higherBound : clipFileSize | |
var readHead = begin | |
while readHead < end { | |
let data = getData(readHead, chunkSize) | |
block(data, nil) | |
readHead += data.count | |
} | |
}) |
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
let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
/// Fetch data | |
}) |
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
webServer?.addHandler(forMethod: "GET", pathRegex: "(.*?).mp4", request: GCDWebServerRequest.self, asyncProcessBlock: { request, completion in | |
let filename = request.url.lastPathComponent | |
let clipFileSize = getClipFileSize() | |
let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
/// Fetch data | |
}) | |
let disposition = "attachment; filename=\"\(filename)\"" | |
response.setValue(disposition, forAdditionalHeader: "Content-Disposition") | |
response.setValue("video/mp4", forAdditionalHeader: "Content-Type") |
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 'package:meta/meta.dart'; | |
class CoordinatorStatus {} | |
class UserinfoModel {} | |
class _UserStatus extends CoordinatorStatus { | |
UserinfoModel model; | |
_UserStatus({this.model}); |
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 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
import 'dart:ui'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { |
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 | |
import Foundation | |
extension OSStatus { | |
var stringValue: String? { | |
withUnsafeBytes(of: self) { | |
String(bytes: $0, encoding: .ascii) | |
} | |
} | |
} |
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 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'menu.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override |
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
enum Token { | |
case num(Int) | |
case op(String) | |
} | |
func tokenize(_ s: String) -> [Token] { | |
let scanner = Scanner(string: s) | |
scanner.charactersToBeSkipped = CharacterSet.whitespaces | |
var tokens = [Token]() | |
while !scanner.isAtEnd { |
NewerOlder