Skip to content

Instantly share code, notes, and snippets.

@y-takagi
y-takagi / DOCUMENT.md
Last active April 29, 2024 16:36
iOSでデータを永続化する方法

How to save data in iOS

この投稿では、iOSのファイルシステムについて理解し、データを永続化(iCloud含む)する方法を紹介する。尚、サンプルコードは動かない可能性もあるので参考程度にして下さい。

iOS File System

アプリがファイルシステムとやり取り出来る場所は、ほぼアプリのサンドボックス内のディレクトリに制限されている。新しいアプリがインストールされる際、インストーラーはサンドボックス内に複数のコンテナを作成し、図1に示す構成をとる。各コンテナには役割があり、Bundle Containerはアプリのバンドルを保持し、Data Containerはアプリとユーザ両方のデータを保持する。Data Containerは用途毎に、さらに複数のディレクトリに分けられる。アプリは、例えばiCloud Containerのように、実行時に追加のコンテナへのアクセスをリクエストすることもある。

IMG_0017_RESIZE.png

図1. An iOS app operating within its own sandbox

@y-takagi
y-takagi / README.md
Last active January 19, 2023 16:09
GoogleのPaginationっぽいやつ

GoogleのPaginationっぽいやつ

Tech Stack

  • Angular
  • Angular Material
  • Tailwindcss
@y-takagi
y-takagi / install-emacs.md
Last active December 7, 2021 06:51
Install emacs to macOS with options.

Install emacs to macOS with options.

Homebrew

Use homebrew formula of emacs head.

https://github.com/d12frosted/homebrew-emacs-plus

brew tap d12frosted/emacs-plus
brew install emacs-plus@28 # Change the 28 part to different version you want to install.
@y-takagi
y-takagi / grpc-web.md
Last active June 19, 2021 01:46
gRPC-Web Basics.

gRPC-Web Basics.

Protocol

Let's Create a Sample App

Create a greet service and client.

Platform

@y-takagi
y-takagi / rust-doc.md
Last active April 20, 2021 10:00
The Rust Programming Language

The Rust Programming Language

  • 輪読会発表資料
  • 教材

4. 所有権を理解する

所有権はRustの最も特徴的な機能であり、これによってGCなしで自動メモリ管理が可能になっています。

4.1 所有権とは?

全てのプログラムは、実行中にメモリを管理する必要があります。プログラミング言語によってメモリ管理の方法が違いますが、大まかには自動で管理するGCタイプ(SwiftのARCも実行時OHを考慮してGCとする)と、手動でメモリを確保、解放するタイプがあります。Rustでは第3の選択肢を取っています。メモリは、コンパイラがコンパイル時にチェックする一定の規則とともに所有権システムを通じて管理されています。どの所有権機能も、実行中にプログラムの動作を遅くすることはありません。

@y-takagi
y-takagi / ionic-framework.md
Last active April 16, 2021 00:36
Ionic Framework の紹介

Ionic Framework の紹介

Ionic Framework とは

Ionic(Drifty Co.)チームが開発している、Webテクノロジー(HTML、CSS、JavaScript)を使って、モバイルとデスクトップアプリケーションをつくるためののUIフレームワーク。

現在、AngularとReactを公式サポートしており、Vueのサポートも開発中。

Other Major Cross-Platform Frameworks

  • React Native
    • Created by Facebook
@y-takagi
y-takagi / rust-setup.md
Last active April 16, 2021 00:33
Rust setup
@y-takagi
y-takagi / typescript-cookbook.md
Last active April 16, 2021 00:30
Typescript Cookbook

Typescript Cookbook

Yet another enum

export const signal = ['red', 'green', 'blue'] as const;
export type Signal = typeof signal[number];

export const color = { red: 0, green: 1, blue: 2 } as const;
export type Color = typeof color[keyof typeof color];
@y-takagi
y-takagi / IBeaconPlugin.kt
Created April 14, 2021 00:32
iBeacon Plugin for capacitor2.
package io.ionic.starter.plugins
import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.content.pm.PackageManager
import com.getcapacitor.NativePlugin
import com.getcapacitor.Plugin
import com.getcapacitor.PluginCall
@y-takagi
y-takagi / 2020.md
Last active December 31, 2020 14:14
2020年の振り返り

2020年の振り返り

twitterで自分の1年のツイートを検索して振り返ってみた。

from:y_takagi since:2020-01-01 until:2020-12-31

tl;dr

  • 今年の2月頃から日本でもコロナ感染者出てきて、1年中自粛モードだった。おそらく来年も続くだろう。
  • 自粛による運動不足によって体調を崩したこともあり、ジムに通うようになった。継続中。
  • 肩こりが酷かったので、分割キーボードを導入してみた。