Skip to content

Instantly share code, notes, and snippets.

View hironytic's full-sized avatar

Hironori Ichimiya hironytic

  • Tokushima, Japan
  • 15:04 (UTC +09:00)
  • X @hironytic
View GitHub Profile
@hironytic
hironytic / wwdc25.md
Last active June 14, 2025 09:13
WWDC 25
flowchart LR

  %% スタイル定義
  classDef introVideo fill:#fff0e6,stroke:#f57c00,stroke-width:4px,color:#000;
  classDef implementationVideo fill:#e6f3ff,stroke:#1565c0,stroke-width:4px,color:#000;
  classDef detailVideo fill:#f5f5f5,stroke:#424242,stroke-width:4px,color:#000;
  classDef updateVideo fill:#e8f5e9,stroke:#2e7d32,stroke-width:4px,color:#000;
  classDef otherVideo fill:#f5f0ff,stroke:#7b1fa2,color:#000;
@hironytic
hironytic / cow.swift
Created June 12, 2022 08:58
COW Problem
import Foundation
let arraySize = 1000000
let loopCount = 1000
class Values {
var values = [Int](repeating: 0, count: arraySize)
func foo1() {
values[0] += values[0]
}
func foo2() {
@hironytic
hironytic / binarySearch.swift
Last active June 16, 2021 01:26
2分探索
/// 2分探索を行います。
/// - Parameters:
/// - value: 探し出す値
/// - low: 下限インデックス
/// - high: 上限インデックス
/// - access: インデックスの値を返すクロージャー
/// - compare: 値同士を比較するクロージャー。第1引数が第2引数より小さければ負の数、大きければ正の数、同じなら0を返します。
/// - Throws: 引数に渡したクロージャーが投げたエラー
/// - Returns: 結果のタプル。0番目の要素は見つかったかどうか(見つかればtrue)、1番目の要素は見つかったインデックスまたは見つからなかったときはその値を挿入するべきインデックス
static func binarySearch<T>(value: T, low: Int, high: Int, access: (Int) throws -> T, compare: (T, T) throws -> Int) rethrows -> (Bool, Int) {
@hironytic
hironytic / shareReplayOne.swift
Last active November 29, 2020 11:52
shareReplay(1)みたいなものを作れなくもなさそう
import Combine
class Foo {
//let s1 = PassthroughSubject<Int, Never>()
let s1 = CurrentValueSubject<Int, Never>(0)
let ss1: AnyPublisher<Int, Never>
init() {
ss1 = s1
@hironytic
hironytic / LayoutConstraint.swift
Created November 15, 2020 06:17
NSLayoutAnchorと同じようなものを作ってみるも、NSLayoutAnchorでいいや、となって使わなかったもの
//
// LayoutConstraint.swift
//
// Copyright (c) 2020 Hironori Ichimiya <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@hironytic
hironytic / attributes.swift
Created March 24, 2019 13:15
Attributes with namespace (Foundation on macOS)
import Cocoa
let uriNs1 = "http://example.com/ns1"
let uriNs2 = "http://example.com/ns2"
let root = XMLNode.element(withName: "root") as! XMLElement
root.addNamespace(XMLNode.namespace(withName: "ns1", stringValue: uriNs1) as! XMLNode)
let element = XMLNode.element(withName: "element") as! XMLElement
element.addNamespace(XMLNode.namespace(withName: "ns2", stringValue: uriNs2) as! XMLNode)
import 'package:flutter/material.dart';
import 'package:my_app/BlocProvider.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
//
// CallStackReporter.swift
// DramaticCrash
//
// Copyright (c) 2018 Hironori Ichimiya <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell