新しいMacが届きました〜

新しいMacが届いた!!嬉しい嬉しい!

ちょっと良いスペックにしちゃいました。

まずは

Homebrewを入れた。超大事。

iTerm2とtmuxも即入れ。

Google日本語文字入力も速攻。


dotfilesの作成。

その前に、dotfileを見られるようにする。

command + shift + .

前回dotfiles作ったときはガーッとコピペしたので、今回はちゃんとアレンジしながら作っていく。

.zshrc

.vimrc

.tmux.conf


anyenvの導入

direnvの導入

neovim導入(うまくいかないのでもっと調べる)


githubからcloneできなくなったので、こちらを参考に設定。

qiita.com

新しい Mac に Git と Node.js の環境を作る - Qiita

あれ、いままでgitにPATH通してなかったかも、と今更気づく…

echo 'export PATH="/usr/local/Cellar/git/2.26.0/bin:$PATH"' >> ~/.zshrc

全然関係ないけどpbcopyの意味がわかった。

$ pbcopy < ~/.ssh/id_rsa.pub

そして無事privateなrepositoryをcloneできるようになった。


zで移動できるように設定。

qiita.com

これないと相当キツい。めっちゃ便利。


brew install yarn

これも大事ね


github.com

これを使う。


redis導入

qiita.com

JDKがないと動かないのでJDKのインストール

ここで、ああああああ

teratail.com

そうだよねえええええええええええってなった。

別の方法を探る

qiita.com

これだ↑

brew install redis

そして

redis-cli -p ポート番号

そうしたら

Could not connect to Redis at 127.0.0.1:****: Connection refused

ぎえええ


ていうかmysqlいれてねえええ

brew install mysql

qiita.com


Dockerインストールする

www.docker.com

Vue 復習中

thisによる参照

thisが指すのはVueインスタンス自身

data: {
  items: [
    {
      name: 'item1',
      price: 200,
      quantity: 3
    },
    {
      name: 'item2',
      price: 340,
      quantity: 2
    },
  ]
},   
computed: {
  totalPrice() {
    // this.itemsはこのVueインスタンスのdataのitems
    return this.items.reduce((sum, item) => {
      return sum + (item.price * item.quantity)
    }, 0)
}

クラスのバインディング

v-bind:class(:class)は、属性値にオブジェクトを指定した場合に、値が真のプロパティ名をclass属性値として反映する。

<p v-bind:class="{error: isError}">
  errorです
</p>

isErrorがtrueのとき、classの属性値がerrorになる(class="error"になる)

{}の中身が複雑になるようなら、算出プロパティとしてVueinstanceに移すほうが良い。

<p v-bind:class="errorMessageClass">
  errorです
</p>
computed: {
  errorMessageClass() {
    return {
      error: isError
    }
  }
}

JavaScriptnのfilter

developer.mozilla.org

const words = ['a', 'aa', 'spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => {
  var option = word.length > 6 ? true : word.length === 1
  console.log(option)
  return option
});

要は、filterの引数で受けている関数で、Arrayの要素ひとつひとつを

trueかfalseかを判断していて、

要素をfalseだった場合は、そのArrayから抜いて、trueだったものを新しくArrayに入れて返すということか。

vim

vim

dein

deniteいれた

ripgrepいれた

:call dein#install()

スペースでファイルの複数選択可能

, u j

project内のファイル名ファジーマッチ

, u f

カレントディレクトリからのファイル指定

, u g

本文中の文字列検索

  • shift jかk

バッファー切り替え

  • ctrl + c

バッファ消す