The Composable Architecture (省略すると TCA) は、コンポジション、テスト、開発者にとっての使いやすさを考慮し、一貫性のある理解しやすい方法でアプリケーションを構築するためのライブラリです。SwiftUI、UIKit などで使用することができ、Apple のどのプラットフォーム (iOS, macOS, tvOS, watchOS) でも使用
import Foundation | |
@dynamicMemberLookup | |
struct Concat<L: Decodable, R: Decodable>: Decodable { | |
init(left: L, right: R) { | |
self.left = left | |
self.right = right | |
} | |
private var left: L | |
private var right: R |
import SwiftUI | |
struct FlowLayoutSampleView: View { | |
@State var width: CGFloat = 180 | |
let tags: [String] = [ | |
"Objective-C", | |
"Swift", | |
// "SwiftSwiftSwiftSwiftSwiftSwiftSwiftSwift", | |
// "SwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwift", |
precedencegroup AssociativeComparisonPrecedence { | |
associativity: left | |
higherThan: ComparisonPrecedence | |
lowerThan: NilCoalescingPrecedence | |
} | |
infix operator <: AssociativeComparisonPrecedence | |
infix operator <=: AssociativeComparisonPrecedence | |
public func < <V: Comparable>(lhs: V, rhs: V) -> (Bool, V) { |
import SwiftUI | |
public extension View { | |
func extend<Content: View>(@ViewBuilder transform: (Self) -> Content) -> some View { | |
transform(self) | |
} | |
func `if`<T: View, F: View>(_ condition: Bool, @ViewBuilder _ then: (Self) -> T, @ViewBuilder `else`: (Self) -> F) -> some View { | |
condition ? ViewBuilder.buildEither(first: then(self)) : ViewBuilder.buildEither(second: `else`(self)) | |
} |
#if canImport(SwiftUI) && DEBUG | |
import SwiftUI | |
struct DebugJsonView: View { | |
let json: JsonElement | |
init(_ json: String) { | |
self.json = JsonElement.parse(json) |
オレは高校生シェル芸人 sudo
新一。幼馴染で同級生の more
利蘭と遊園地に遊びに行って、黒ずくめの男の怪しげな rm -rf /
現場を目撃した。端末をみるのに夢中になっていた俺は、背後から近づいてきたもう1人の --no-preserve-root
オプションに気づかなかった。
俺はその男に毒薬を飲まされ、目が覚めたら・・・ OS のプリインストールから除かれてしまっていた!
『 sudo
がまだ $PATH
に残っていると奴らにバレたら、また命を狙われ、他のコマンドにも危害が及ぶ』
上田博士の助言で正体を隠すことにした俺は、 which
に名前を聞かれて、とっさに『gnuplot
』と名乗り、奴らの情報をつかむために、父親がシェル芸人をやっている蘭の $HOME
に転がり込んだ。ところが、このおっちゃん・・・とんだヘボシェル芸人で、見かねた俺はおっちゃんになりかわり、持ち前の権限昇格能力で、次々と難タスクを解決してきた。おかげで、おっちゃんは今や世間に名を知られた名エンジニア、俺はといえばシェル芸 bot のおもちゃに逆戻り。クラスメートの convert
や ojichat
や textimg
にお絵かきコマンドと誤解され少年ワンライナーお絵かき団を結成させられる始末。
ではここで、博士が作ってくれたメカを紹介しよう。最初は時計型麻酔 kill
。ふたについた照準器にあわせてエンターを押せば、麻酔シグナルが飛び出し、プロセスを瞬時に sleep
させることができる。
次に、蝶ネクタイ型 banner
。裏についているダイヤルを調整すれば、ありとあらゆる大きさのメッセージを標準出力できる。必殺のアイテムなら fork
力増強シューズ。電気と磁力で足を刺激し、 :(){ :|:& };:
でプロセステーブ
/* | |
Written By Pan ZhenPeng(@peterpan980927) of Alibaba Security Pandora Lab | |
use it on macOS: cc poc.c -o poc while True; do ./poc ; done | |
*/ | |
#include <errno.h> | |
#include <signal.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
// Usage | |
let pixelBuffer: CVImageBuffer? = createPixelBufferFrom(image: image) // see https://gist.github.com/rampadc/10a7dc257552f1fb86c1fcc2d1671bd9 | |
let sampleBuffer: CMSampleBuffer? = createSampleBufferFrom(pixelBuffer: pixelBuffer) | |
// Function | |
func createSampleBufferFrom(pixelBuffer: CVPixelBuffer) -> CMSampleBuffer? { | |
var sampleBuffer: CMSampleBuffer? | |
var timimgInfo = CMSampleTimingInfo() | |
var formatDescription: CMFormatDescription? = nil |
//https://nshipster.com/device-identifiers/ | |
//Besides identifierForVendor.. | |
/* | |
Locale information is the greatest source of identifying information on Apple platforms. | |
The combination of your preferred languages, region, calendar, time zone, | |
and which keyboards you have installed say a lot about who you are | |
especially if you have less conventional preferences. | |
*/ |