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
/// Decodes a dynamically-generated Uniform Type Identifier for inspection purposes. (**NOT FOR PRODUCTION USE!**) | |
/// Many, many thanks to http://alastairs-place.net/blog/2012/06/06/utis-are-better-than-you-think-and-heres-why/ | |
/// | |
/// <https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-BCGCDHIJ> | |
func decodeDynUTI(_ uti: String) -> String? | |
{ | |
let vec = Array("abcdefghkmnpqrstuvwxyz0123456789") | |
let encoded = Array(uti).suffix(from: 5) | |
var result: [UInt8] = [] |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>WebGL perf test</title> | |
</head> | |
<body> | |
<button id="create-button">Create canvas</button> | |
<button id="alloc-button" disabled>Allocate buffer</button> | |
<button id="remove-button" disabled>Remove canvas</button> |
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
type Ten<T extends any[]> = [...T, ...T, ...T, ...T, ...T, ...T, ...T, ...T, ...T, ...T] | |
type Tuple<T, N extends number> = | |
N extends 0 ? [] : | |
N extends 1 ? [T] : | |
N extends 2 ? [T,T] : | |
N extends 3 ? [T,T,T] : | |
N extends 4 ? [T,T,T,T] : | |
N extends 5 ? [T,T,T,T,T] : | |
N extends 6 ? [T,T,T,T,T,T] : | |
N extends 7 ? [T,T,T,T,T,T,T] : |
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 colorsys | |
import base64 | |
import math | |
import json | |
import requests | |
from tqdm import tqdm | |
from time import time_ns | |
from pyquaternion import Quaternion | |
from mcap.mcap0.writer import Writer |
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
FROM ubuntu:jammy | |
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \ | |
git \ | |
python3 \ | |
python3-pip \ | |
cmake \ | |
clang \ | |
llvm-dev \ | |
libclang-dev \ |
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
type MaybeAwait<P> = P extends Promise<infer T> ? T : P; | |
function maybeAsync<Args extends unknown[], TYield, TReturn>( | |
body: (...args: Args) => Generator<TYield, TReturn, MaybeAwait<TYield>> | |
): (...args: Args) => (TYield extends Promise<infer _P> ? Promise<TReturn> : TReturn); | |
function maybeAsync<Args extends unknown[], TYield, TReturn>( | |
body: (...args: Args) => Generator<TYield, TReturn, MaybeAwait<TYield>> | |
): (...args: Args) => (Promise<TReturn> | TReturn) { | |
return (...args: Args) => { |
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
node_modules | |
out | |
package-lock.json |
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
// Would you rather use this: | |
NSLayoutConstraint(item: label, attribute: .Leading, relatedBy: .Equal, toItem: button, attribute: .Trailing, multiplier: 1, constant: 0).active = true | |
// or this? | |
label.constrain(.Leading, .Equal, to: button, .Trailing, plus: 20) | |
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 Foundation; | |
NS_ASSUME_NONNULL_BEGIN | |
@interface Function<__contravariant InType, __covariant OutType> : NSObject | |
{ | |
// interestingly, this does work here (though OutType & InType are not available in the @implementation) | |
OutType (^_block)(InType); | |
} |
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
// please... don't do this | |
import Foundation | |
class F: NSObject | |
{ | |
@objc func foo() { | |
print("hi") | |
} | |
} |
NewerOlder