Skip to content

Instantly share code, notes, and snippets.

View wata's full-sized avatar

Wataru Nagasawa wata

View GitHub Profile
@wata
wata / PRIVACY.md
Created November 14, 2026 04:02
PinPage プライバシーポリシー / Privacy Policy

PinPage プライバシーポリシー / Privacy Policy

日本語

PinPage は、利用者の個人情報を集めたり、開発者や第三者へ送ったりしません。

  • 保存するのは、表示する Web ページの URL と、アプリの設定(表示中に画面を消すか、電源を入れたら自動で開くか)だけです。どれもこの端末の中だけに保存します
  • アプリが通信するのは、利用者が設定した URL の Web ページだけです。そのページが読み込む内容やそのページでのやり取りは、ページを提供するサイトの取り扱いに従います。ページが保存する Cookie などのデータは、この端末の WebView の中に残ります
  • スマホから URL を入力するため、設定画面を開いている間だけ、テレビの中で小さな Web サーバーを同じネットワーク(LAN)の中に向けて動かします。開くたびに変わる使い捨ての合言葉(token)を含むアドレスにしか応えず、受け取るのは入力された URL だけです。設定画面を閉じると止まります
  • ローカルネットワークへのアクセスの許可は、LAN の中の Web ページを表示することと、上のスマホからの入力を受け取ることだけに使います
@wata
wata / check-translations.sh
Last active May 15, 2025 13:08
Localizable.xcstringsファイルを直接編集し、英語(ソース言語)以外の言語で英語のままの翻訳に⚠️マークを追加します
#!/bin/bash
# 使用方法のヘルプを表示する関数
show_help() {
echo "使用方法: $0 <JSONファイル>"
echo " 指定されたJSONファイルを直接編集し、英語(ソース言語)以外の言語で英語のままの翻訳に⚠️マークを追加します"
exit 1
}
# 引数チェック
@wata
wata / copy-and-encode-videos.sh
Created December 10, 2024 15:10
Macのフォルダアクション用、動画ファイルをHEVCで再エンコードするスクリプト
wait_until_ready() {
local file="$1"
local timeout=30 # 最大待機時間(秒)
local elapsed=0
echo "Waiting for $file to be ready..."
# ファイルが準備完了するまでループ
while :; do
# kMDItemDurationSeconds を取得
@wata
wata / UIView+Borders.swift
Created May 31, 2023 06:48
Swift Extension for adding borders to any side of UIView
extension UIView {
struct Side: OptionSet {
let rawValue: Int
static let left = Side(rawValue: 1 << 0)
static let right = Side(rawValue: 1 << 1)
static let top = Side(rawValue: 1 << 2)
static let bottom = Side(rawValue: 1 << 3)
}
@wata
wata / TextView.swift
Last active May 9, 2022 13:18
Add placeholder text to UITextView in Swift
class TextView: UITextView {
override init(frame: CGRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
commonInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
@wata
wata / CLLocation+Extensions.swift
Last active January 14, 2022 04:16
Get TimeZone from CLLocation. Works locally and offline with no restrictions. source of json file: https://github.com/Alterplay/APTimeZones/blob/master/APTimeZones/timezonesDB.json
import CoreLocation
struct TimeZoneInfo: Decodable {
let location: CLLocation
let timeZone: TimeZone
enum CodingKeys: String, CodingKey {
case latitude
case longitude
case identifier = "zone"
@wata
wata / EventStoreNotificationInfo.swift
Last active April 29, 2026 22:58
Parse EKEventStoreChanged notification user info
struct EventStoreNotificationInfo {
let changeType: Int
let calendarDataChanged: Bool
let remindersDataChanged: Bool
let changedObjectIDs: [NSObject]
let modifiedObjectIdentifiers: Set<String>? // Not included in iOS 16?
struct UserInfoKeys {
static let changeType = "EKEventStoreChangeTypeUserInfoKey"
static let calendarDataChanged = "EKEventStoreCalendarDataChangedUserInfoKey"
@wata
wata / connect.sh
Last active May 18, 2021 04:49
Connect AirPods from Terminal
# AlfredのWorkflowではPATHを通す処理が必要
# (これをせずに直にフルパス打つ方法もあるがApple Siliconマシンとの互換性問題が生じる)
# Cocoapods
export PATH=/usr/local/bin:$PATH
# Cocoapods(ARM)
export PATH=/opt/homebrew/bin:$PATH
AIR_PODS_NAME=wAPP
# Bluetooth接続
@wata
wata / siri.applescript
Created April 20, 2021 06:24
Siriコマンド入力するAppleScript
tell application "System Events" to tell the front menu bar of process "SystemUIServer"
tell (first menu bar item whose description is "Siri")
perform action "AXPress"
end tell
end tell
delay 1
tell application "System Events" to tell the process "NotificationCenter"
set notifyWindows to every window
struct CopyableText: UIViewRepresentable {
let text: String
init(_ text: String) {
self.text = text
}
func makeUIView(context: Context) -> UILabel {
let label = CopyableLabel()
label.text = text