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
// | |
// LayoutThatFits.swift | |
// WWDC22Experiments | |
// | |
// Created by Ryan Lintott on 2022-06-08. | |
// | |
import SwiftUI | |
struct LayoutThatFits: Layout { |
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 | |
lazy var hiddenView: UIView = { | |
let hiddenView: UIView | |
// iOS 14.1 -> _UITextFieldCanvasView | |
// iOS 15.0 -> _UITextLayoutCanvasView | |
if let klass = NSClassFromString("_UITextFieldCanvasView") as? UIView.Type { | |
hiddenView = klass.init() |
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/bash | |
import re | |
import zlib | |
pdf = open("some_doc.pdf", "rb").read() | |
stream = re.compile(r'.*?FlateDecode.*?stream(.*?)endstream', re.S) | |
for s in stream.findall(pdf): | |
s = s.strip('\r\n') | |
try: |
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
<?php | |
/** | |
* @param $http2ch the curl connection | |
* @param $http2_server the Apple server url | |
* @param $apple_cert the path to the certificate | |
* @param $app_bundle_id the app bundle id | |
* @param $message the payload to send (JSON) | |
* @param $token the token of the device | |
* @return mixed the status code (see https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW18) |
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
function hdrDetails(index, elm, length, type) { | |
// divide the length into its largest unit | |
var units = [ | |
[1024 * 1024 * 1024, 'Go'], | |
[1024 * 1024, 'Mo'], | |
[1024, 'Ko'], | |
[1, 'bytes'] | |
]; | |
for(var i = 0; i < units.length; i++){ |