Skip to content

Instantly share code, notes, and snippets.

@y-takagi
y-takagi / install-git-completion.sh
Created September 22, 2011 08:32 — forked from abellmann/install-git-completion.sh
Mac OS X - Install Git Completion
GIT_VERSION=`git --version | awk '{print $3}'`
URL="https://raw.github.com/git/git/v$GIT_VERSION/contrib/completion/git-completion.bash"
BASHRC="$HOME/.bashrc"
echo "Downloading git-completion for git version: $GIT_VERSION..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi
@y-takagi
y-takagi / review_matcher.rb
Last active July 6, 2016 02:06
Auto code review group matcher
require 'net/http'
require 'net/https'
require 'json'
require 'pit'
@host = "api.github.com"
@ng_member = [] # for bot
def group_match app_id, team_id, groups
@token = access_token(app_id)
@y-takagi
y-takagi / Dockerfile
Last active June 30, 2016 04:50
Data Volume の一例
FROM image
COPY hoge.txt /tmp
VOLUME /tmp
@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 / DOCUMENT.md
Created July 1, 2016 03:07
iOS10とXcode8の気になった機能をリストアップ
@y-takagi
y-takagi / rxswift.org
Last active November 3, 2016 12:38
Introduction to ReactiveX/RxSwift

Introduction to ReactiveX/RxSwift

RxSwiftは、ReactiveX(Rx)のswift実装である。この投稿ではRxの概要をRxSwiftを用いて解説する。

Rxを簡単に説明すると、下記のものを組み合わせたライブラリである。

Rx = Observable + Operators + Scheduler

基本的にはObserverパターンの拡張であり、非同期データストリームであるObservableに対して

@y-takagi
y-takagi / migrate_ecr_region.sh
Created August 24, 2016 02:18
ECRのリージョン移行
#!/bin/bash
#
# 前準備として、移行先に各イメージのレポジトリを作成しておく必要あり。
# $from、$to、$aws_account_id、$images は適宜変更する。
#
set -e
from="us-east-1"
to="ap-northeast-1"
aws_account_id=""
@y-takagi
y-takagi / docker_cookbook.org
Last active November 4, 2016 02:02
Usefull recipes when using docker

Docker Cookbook

環境は以下。

Host OSDocker version
Ubuntu 16.041.12.3

1. Move storage directory

Dockerは、imageやその他データをデフォルトでは /var/lib/docker に格納する。

@y-takagi
y-takagi / Swift Guide (v3.0).org
Last active July 25, 2020 03:38
Swift Guide (v3.0)

Swift Guide (v3.0)

Comment

1行コメント

// this is a comment

複数行コメント

@y-takagi
y-takagi / promisekit.org
Last active January 7, 2017 20:37
PromiseKit Guide

PromiseKit Guide (v4.1.0)

PromiseKit の使い方。

Create Promise

enum SampleError: Error {
 case error
}