Rodhos Soft

備忘録を兼ねた技術的なメモです。Rofhos SoftではiOSアプリ開発を中心としてAndroid, Webサービス等の開発を承っております。まずはご相談下さい。

LFS

medium.com

qiita.com

www.slideshare.net

gitで管理されるべきでないバイナリファイルなどをgit上で管理するための機能らしい。 gitはハッシュ値と保存先をリポジトリで管理している。バイナリファイルは他のストレージに保存されている。 チェックアウトする際にはコミットに含まれているバイナリファイルがストレージからとってこられる。

SourctreeでLFSは簡単にインストールして扱うことができる。

長押し系

ひとまず色々あるのでまとめて

/* 画像のクリックなどのイベントを無視  */
img {
    pointer-events: none;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;    
}

スクロール禁止にする

この記事に詳細は書いてある。

qiita.com

touchmoveをaddEventListenerしてpreventDefaultする。その際にpassive:falseを指定する必要がある。

function handleTouchMove(event:TouchEvent){
  console.debug("touchmove.noScroll prevent..");
  event.preventDefault();
}
          /// ひとまず一律スクロール禁止にする。
          console.debug("setup touchmove.noScroll prevent..");
          document.addEventListener('touchmove', handleTouchMove, { passive: false });
          // document.removeEventListener('touchmove', handleTouchMove, { passive: false });   

中身が空のフォルダになる

Sorcetreeでcloneしたところ、中身が入っていないフォルダができることがあった。

warning: templates not found が出ていた。以下をみると重たいかららしいが、今回は他のブランチをチェックアウトした。

sourcetreeでcloneした時に warning: templates not found /usr/local/git/share/git-core/templates というエラーが出る - Qiita

apatcheの使い方

macで初歩的な使い方を忘れていたのでメモしておく。

入っているか

httpd -v

開始

 sudo apachectl start
 sudo apachectl restart

動いているか

ps aux | grep httpd

設定、ドキュメントルートなどは

httpd.conf

ファイルにある。

BASIC認証

久しぶりにやってはまった。

.htaccess をドキュメントルート以下で制限したいところにおくのだが、 そもそも、それが効くのはhttpd.confでAllowOverride Noneではだめで、Allとかにしておく必要があった。

あと、Basic認証は通ってしまえばあとは出てこないので、.htpasswordとかのユーザー名とかを変えて出すようにしたりした。他の方法もあるかもしれない。 フルパスはcatしてみれば出てくるのでそこまではまらない。

はまったこと

iOS13ではcrossorgin設定だけではだめで、BASIC認証もかかっているときはmanifest.jsonファイルを.htaccessで許可しておかないとだめなようだ。

<files manifest.json>
Satisfy any
order allow,deny
allow from all
</files>

rxjsで購読を止める

色々やり方はあると思うが一つ聞いたのはこういうもの。

const root = new BehaviorSubject<"start"|"end">("start");
const subject = new Subject<string>();
const op = root.pipe(mergeMap((x) => {
    if (x == "end") {
        return throwError(new Error("end"));
    }
    return subject;
})).pipe()
op.subscribe((x) => {
    console.log("1:"+x);
},(e) => {
    console.log("1:"+e);
})
subject.next("a");
subject.next("b");
root.next("end");
root.next("start");
op.subscribe((x) => {
    console.log("2:"+x);
},(e) => {
    console.log("2:"+e);
})
subject.next("c");
subject.next("d");
root.next("end");
root.next("start");
subject.next("e");
subject.next("f");
/*
1:a
1:b
1:Error: end
2:c
2:d
2:Error: end
*/