Skip to content

Instantly share code, notes, and snippets.

View 1024jp's full-sized avatar
👻
boo

1024jp 1024jp

👻
boo
View GitHub Profile
@niw
niw / download_macos_and_create_install_disk.sh
Last active October 23, 2024 03:20
A script to download macOS install image and create an install disk image
#!/usr/bin/env bash
set -e
VOLUME_PATH=/Volumes/installer
while getopts ":d:h" opts; do
case $opts in
d)
VOLUME_PATH=$OPTARG
;;
@niw
niw / README.md
Created July 26, 2019 03:44
A simple text file for Tweet to know if I could be trusted or not.

🐱 にゃーん

Context:

@niw
niw / example.swift
Created April 4, 2020 00:47
macOS 10.15.4 Catalyst erases the underline for input method marked text if content attributed text has `.underlineStyle`.
let textView = UITextView(frame: view.bounds)
textView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
let text = NSMutableAttributedString(string: "test")
text.addAttributes([
.font: UIFont.systemFont(ofSize: 20.0),
.foregroundColor: UIColor.label,
.underlineStyle: 0
], range: NSRange(location: 0, length: text.length))
@rogerluan
rogerluan / String+Regex.swift
Created July 27, 2020 02:26
Handy Regex utility to find and replace matching groups in Swift.
extension String {
/// Finds matching groups and replace them with a template using an intuitive API.
///
/// This example will go through an input string and replace all occurrences of "MyGreatBrand" with "**MyGreatBrand**".
///
/// let regex = try! NSRegularExpression(pattern: #"(MyGreatBrand)"#) // Matches all occurrences of MyGreatBrand
/// someMarkdownDocument.replaceGroups(matching: regex, with: #"**$1**"#) // Surround all matches with **, formatting as bold text in markdown.
/// print(someMarkdownDocument)
///
/// - Parameters:
@defagos
defagos / ExampleView.swift
Last active October 1, 2024 06:13
Send a message to the UIKit responder chain from a SwiftUI view
@objc protocol ExampleActions: AnyObject {
func pushUIKitViewController()
}
struct ExampleView: View {
@FirstResponder private var firstResponder
var body: some View {
Button {
firstResponder.sendAction(#selector(ExampleActions.pushUIKitViewController))
@kishikawakatsumi
kishikawakatsumi / gist:079f800561869c386e7702048b7580e1
Last active January 16, 2025 12:40
applelocalization.com に対するデータ追加更新の手順
** 概要
applelocalization-toolsでシステムの言語ファイルを読み取り、applelocalization-dataのデータを作る。
追加したデータを表示できるようにWebフロントエンド(エンドポイントやドロップダウンメニューを追加する)を修正する。
*** 手順 1〜11
- github.com/kishikawakatsumi/applelocalization-tools
- システムに含まれる言語ファイルを読み取りDBの1レコード単位に整形したJSONファイルを作る
- JSONファイルからDBにインポートできるデータを作る。
@niw
niw / MainView.swift
Last active May 12, 2025 23:02
Sample code to implement a vertically gorwing NSTextView in SwiftUI
import AppKit
import SwiftUI
public struct TextView: NSViewRepresentable {
@Binding
var text: String
var font: NSFont?
public init(
text: Binding<String>
@k16shikano
k16shikano / SKILL.md
Last active July 28, 2026 02:25
japanese-tech-writing/SKILL
name japanese-tech-writing
description 日本語の技術文書・書籍原稿の文章規範。整形(一文一行、引用ブロック、脚注、コラム記法)、段落と論証の構成(パラグラフライティング)、論証の厳密さ(ツッコミどころの除去)、読み手の負荷の管理、視点と語り、演出の抑制、LLM っぽい空句の禁止、冗長の排除を定める。日本語で技術書の章、草稿、記事、解説文を書くとき、または推敲・リライトするときに使用する。

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

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

整形