Skip to content

Instantly share code, notes, and snippets.

View niaeashes's full-sized avatar

Nia niaeashes

  • Fukuoka
  • 10:32 (UTC +09:00)
View GitHub Profile
このコードベースを監査して。
前提の解除: CLAUDE.md / SPEC / README は監査の「基準」ではなく「対象」。
規約に従っているかではなく、規約・命名・設計前提そのものが正しいかを疑うこと。
プロジェクト自身のドキュメントを採点基準に使った瞬間、その監査は失敗している。
観点:
1. 名前と実体 — 全ディレクトリ・クラス・用語について「ドキュメントを開かず、
名前だけで何をするものか正しく分かるか」。他エコシステムから輸入されて
意味を失った慣習(Go の cmd/ 等)を指摘。
#!/usr/bin/env ruby
require 'date'
require 'optparse'
require 'pathname'
require 'json'
require 'fileutils'
# ---
# 1. Option Parsing and Help
import SwiftUI
// MARK: - Basic
public struct CellLayout<Icon: View, Content: View, Accessory: View>: View {
@State var cellHeight: CGFloat = 0
var horizontalGap: CGFloat
var verticalGap: CGFloat
@niaeashes
niaeashes / DebugJsonView.swift
Last active March 15, 2024 05:57
SwiftUI JSON View for Debugging
#if canImport(SwiftUI) && DEBUG
import SwiftUI
struct DebugJsonView: View {
let json: JsonElement
init(_ json: String) {
self.json = JsonElement.parse(json)
import SwiftUI
struct ContentView: View {
var body: some View {
ScrollView {
LazyVStack {
ForEach(0..<10000, id: \.self) { i in
Text("No.\(i)")
.padding()
import SwiftUI
struct OffsetKey: PreferenceKey {
static var defaultValue: CGFloat = .zero
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
value = nextValue()
}
}
struct ContentView: View {
@niaeashes
niaeashes / InfinityScrollView.swift
Last active January 26, 2022 04:54
SwiftUI Only Infinity Scrolling (get data from datasource class)
import SwiftUI
import Combine
protocol InfinityScrollDataSource: AnyObject {
associatedtype Element: Identifiable
typealias Index = Int
associatedtype ObjectWillChangePublisher : Publisher = ObservableObjectPublisher where ObjectWillChangePublisher.Failure == Never
var count: Int { get }
var objectWillChange: ObjectWillChangePublisher { get }
@niaeashes
niaeashes / Camera.swift
Last active January 18, 2022 08:58
iOS Camera Implementation
//
// Camera.swift
// CameraTest
//
import UIKit
import CoreImage
import VideoToolbox
import AVFoundation
const validate = require('json-schema').validate;
const YAML = require('yaml');
const fs = require('fs').promises;
const main = async () => {
const doc = YAML.parse(await fs.readFile('./doc.yml', { encoding: 'utf-8' }));
const schema = YAML.parse(await fs.readFile('./schema.yml', { encoding: 'utf-8' }));
console.log({ doc, schema });
console.log(validate(doc, schema));
}
@niaeashes
niaeashes / diceroll.ts
Last active January 21, 2021 15:51
diceroll.ts
const rollSingle = (face: number, rolled: number[]): number => {
const r = Math.ceil(Math.random() * face)
rolled.push(r)
return r
}
const roll = (count: number, face: number, rolled: number[]): number => [...Array(count)].reduce(r => r + rollSingle(face, rolled), 0)
globalThis.roll = roll