Skip to content

Instantly share code, notes, and snippets.

View bannzai's full-sized avatar
スターください

bannzai bannzai

スターください
View GitHub Profile
@bannzai
bannzai / swiftui.swift
Last active October 3, 2019 11:07
SwiftUI with SwiftDSL vs SwiftUI not SwiftDSL
import UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
self.window = window
}
@bannzai
bannzai / InfinitePlayView.swift
Created October 19, 2019 16:33
InfinitePlayView
public class VideoPlayerView: UIView {
fileprivate let resourcePath: String
fileprivate let fileExtension: String
fileprivate let asset: AVAsset
fileprivate let playerItem: AVPlayerItem
fileprivate let player: AVPlayer
public required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
public init(resourcePath: String, ofType: String) {
self.resourcePath = resourcePath
@bannzai
bannzai / test_yaml_with_slack_id.yml
Last active November 20, 2019 00:00
notifier_test.yml
- bannzai:
github:
login: bannzai
slack:
id: XXXXXXXX
@bannzai
bannzai / test.yml
Last active November 20, 2019 06:55
Notifier test.yml
- id: bannzai
github:
login: yudai-hirose
slack:
name: bannzai
- id: koooootake
github:
login: rina-kotake
slack:
name: rina.kotake
@bannzai
bannzai / convert.swift
Created January 15, 2020 09:24
ロマンが無い書き方
typealias InputAndExpected = [String: String]
let x: InputAndExpected = [
"11": "11.0",
"11.0": "11.0",
"11.01": "11.01",
"11.1": "11.1",
"11.10": "11.10",
"11.11": "11.11"
]
{
"sourcekit-lsp.serverPath": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp",
"sourcekit-lsp.serverArguments": [
"-Xswiftc",
"-sdk",
"-Xswiftc",
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.7.sdk",
"-Xswiftc",
"-target",
"-Xswiftc",
@bannzai
bannzai / codegen.yml
Last active November 24, 2020 05:01
graphql_codegen_typescript
generates:
types.ts:
plugins:
- typescript
- typescript-operations
@bannzai
bannzai / example.swift
Created September 4, 2021 10:46
Example
import Foundation
struct ToDo : Identifiable, Equatable {
let id: UUID
var title: String
var done: Bool
}
let id = UUID()
let todo = ToDo(id: id, title: "value1", done: false)
@bannzai
bannzai / random_emoji.dart
Created November 23, 2022 11:32
Dart#randomEmoji
import 'dart:math';
void main() async {
print(_randomEmoji());
}
String _randomEmoji() {
final emojis = _emojis();
return emojis[Random().nextInt(emojis.length - 1)];
}
struct SearchView: View {
@State var text: String
@FocusState var focused: Bool
@Async<[Item]> var async
var body: some View {
VStack {
TextField("Placeholder", text: $text)
.focused($focused)
.onSubmit {