リモートで働くプログラマーの検索結果

リモ太がググったことの覚書

2020-05-01から1ヶ月間の記事一覧

nuxt-property-decoratorでasyncDataを使うときの書き方

以下の記事に他にも色々書き方書いてあった shigekitakeguchi.github.io asyncDataでデータを取得してローカルステートに入れるのはこんな感じ asyncDataで取得したのを入れる変数を定義しとかないとtypescript的にエラーが出るので定義をする @Component({ …

homebrewでmysqlをインストールする

brew install mysql すでにinstallしてたら以下のように表示される Error: mysql 8.0.19 is already installed To upgrade to 8.0.19_1, run `brew upgrade mysql`. 以下のコマンドでインストールされているmysqlの内容を表示 brew info mysql 以下のコマン…

JSON.stringify() でオブジェクトの比較をするとうまくいかない

qiita.com とのこと JSON.stringify()の代わりにjson-stable-stringifyを使ってみる github.com install npm install json-stable-stringify 使ってみる import stringify from 'json-stable-stringify' const a = { a: 1, b: 2} const b = { b: 2, a: 1} co…

npm install したら 「ERROR:root:code for hash md5 was not found.」と表示される

brewでpythonをinstallし直したらいいらしいんだけど 2系のpythonをuninstallしようとしたらbrewのリポジトリがないと言われ以下のようにしてinstallした brew install python@2 これだと No available formula with the name "python@2" こうなる brew inst…

electron-builderでパッケージングするとアイコンがデフォルトのまま変わらない問題

なんでかわからない・・・ build/icon.png build/icon.ico を入れてビルドスルだけだと思ったけど package.jsonに以下のように書いても駄目で なぜかインストーラーだけアイコンが設定されている { "build": { "win": { "icon": "build/icon.png" }, } } 以…

electron-builderでパッケージングすると画像が表示されない問題

extraFilesやextraResourcesの仕組みを使って開発中とパッケージングしたのを分岐する必要がある プロジェクト直下に画像用のimgフォルダがある場合 package.jsonに以下の記述を追加 { "name": "sample", "version": "1.0.0", "description": "", // 略 "bui…

safariだとnavigator.permissions.queryがないと怒られる

navigator.permissions.query 2020年5月時点ではsafariでは対応してないみたい 存在チェックしてgetUserMedia直接呼ぶことにする

javascriptで文字列の前方一致

aruo.net startsWithがあるらしい //startswith var str = 'To be, or not to be, that is the question.'; console.log(str.startsWith('To be')); // true console.log(str.startsWith('not to be')); // false console.log(str.startsWith('not to be', 1…

homebrewで入れたpostgresqlをupgradeしたら動かなくなった

psqlを実行すると以下の様なメッセージが表示される The data directory was initialized by PostgreSQL version 11, which is not compatible with this version 12.2. 書いてあるとおり11で作られたデータだから12では動かないと 以下を実行してデータコン…

javascriptでhtmlの文字列をパースしてimgタグのsrcを抜き出す

以下のような感じでsrcの中を取得する const text = "<img src='http://example.com/image.png'>テスト画像" const parser = new DOMParser(); const htmlDoc = parser.parseFromString(text, 'text/html'); const img = htmlDoc.querySelector('img') if (img) { console.log(img.src) } これを実行…

vue-virtual-scrollerをnuxtプロジェクトでつかってみる

仮想スクロールライブラリであるvue-virtual-scrollerを使ってみる チャットとか大量のリストを表示するときに表示されているところだけdomを作ってくれる系のライブラリ github.com インストール npm install --save vue-virtual-scroller typescript用に型…

javascriptで配列の要素を入れ替える

let array = [1,2,3,4,5] // 入れ替える要素のindex const index = 2; array.splice(index-1, 2, array[index], array[index-1]); console.log(array) => [1,3,2,4,5] www.infoscoop.org Arrayオブジェクトのsplice()メソッドは、配列から要素を削除・追加し…