Skip to content

Instantly share code, notes, and snippets.

@k16shikano
k16shikano / SKILL.md
Last active November 5, 2026 06:52
japanese-tech-writing/SKILL
name japanese-tech-writing
description 日本語の技術文書・書籍原稿の文章規範。段落と論証の構成(パラグラフライティング)、論証の厳密さ(ツッコミどころの除去)、読み手の負荷の管理、視点と語り、演出の抑制、LLM っぽい空句の禁止、翻訳調の比喩と擬人化の禁止(「運ぶ」「効く」「開かれた問い」など)、冗長の排除を定める。日本語で技術書の章、草稿、記事、解説文を書くとき、または推敲・リライトするときに使用する。
license Unlicense(https://gist.github.com/k16shikano/67625f2a7d96e3bbdfae8d571a936063)

日本語技術文書の文章規範

日本語で技術的な原稿(書籍の章、記事、解説文)を書く・推敲するときは、以下の規範に従う。

import Foundation
struct MinHeap {
var items: [Int] = []
//Get Index
private func getLeftChildIndex(_ parentIndex: Int) -> Int {
return 2 * parentIndex + 1
}
private func getRightChildIndex(_ parentIndex: Int) -> Int {
// Old way of doing things.
let actionButton = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(someMethod()))
// New way of doing things.
let button = UIBarButtonItem(title: "Done", style: .done) { _ in
// Do stuff here.
}
convenience init(title: String?, style: UIBarButtonItem.Style, closure: @escaping UIBarButtonItemTargetClosure) {
self.init(title: title, style: style, target: nil, action: nil)
targetClosure = closure
action = #selector(UIBarButtonItem.closureAction)
}
@objc func closureAction() {
guard let targetClosure = targetClosure else { return }
targetClosure(self)
}
@BeauNouvelle
BeauNouvelle / UIBarButtonItem Closure 1.swift
Last active April 11, 2019 02:46
UIBarButtonItem Closure
extension UIBarButtonItem {
/// Typealias for UIBarButtonItem closure.
private typealias UIBarButtonItemTargetClosure = (UIBarButtonItem) -> ()
private class UIBarButtonItemClosureWrapper: NSObject {
let closure: UIBarButtonItemTargetClosure
init(_ closure: @escaping UIBarButtonItemTargetClosure) {
self.closure = closure
}
@gregsabo
gregsabo / AudioKitCheatSheet.markdown
Last active June 27, 2021 22:03
AudioKit Cheat Sheet

Play a sine wave.

import AudioKit

let osc = AKOscillator()
osc.frequency = 440.0
osc.start()
AudioKit.output = osc
AudioKit.start()
@dclelland
dclelland / UIImage+Extensions.swift
Created September 17, 2017 11:48
Testing out the new UIGraphicsImageRenderer class on iOS 11
import UIKit
extension UIImage {
convenience init?(color: UIColor, size: CGSize = CGSize(width: 1.0, height: 1.0)) {
let image = UIGraphicsImageRenderer(size: size).image { context in
color.setFill()
context.fill(CGRect(origin: .zero, size: size))
}
@loucimj
loucimj / Diffable.swift
Last active April 12, 2018 16:38
Diffable workaround for structs with IGListKit
//
// Diffable.swift
//
// Created by danielgalasko on 8/5/17.
//
import Foundation
import IGListKit
import Foundation
extension String {
func snakecased() -> String {
return self.replacingOccurrences(of: "(?<=[^A-Z])([A-Z])", with: "_$0", options: .regularExpression).lowercased()
}
}
@cmoulton
cmoulton / Custom HTTP Headers with Swift and Alamofire.swift
Last active December 1, 2025 21:04
Custom HTTP Headers with Swift 3 or 4 and Alamofire 4.0-4.7: See https://grokswift.com/custom-headers-alamofire4-swift3/ for explanations
// MARK: - Adding a header to a single request
func doRequestWithHeaders1() {
let headers: HTTPHeaders = [
"X-Mashape-Key": MY_API_KEY,
"Accept": "application/json"
]
Alamofire.request("https://mashape-community-urban-dictionary.p.mashape.com/define?term=smh", headers: headers)
.responseJSON { response in
debugPrint(response)