2018-01-01から1年間の記事一覧
middleware/redirect.js export default function({ route, redirect }) { const currentPath = route.path; if (currentPath === '/') { redirect('/jp'); return; } } nuxt.config.js router: { middleware: 'redirect' }, ref NuxtをSPAモードで動かすと…
$ mkdir project_name $ cd project_name $ bundle init $ echo "gem 'rails'" >> Gemfile $ bundle install --path vendor/bundle --jobs=4 $ bundle exec rails new . -B -d mysql --skip-turbolinks --skip-test --api # -B: bundle installを行わないよ…
cron は決められた時間にコマンドを実行するデーモン(Unix系のOSで、主にバックグラウンドで動作するプロセス) ユーザーが直接コマンドをプロンプトに入力しなくても希望の時間に特定のコマンドを実行するための仕組み cronはデーモンとしてシステム起動時に…
背景 trello のボードを整理したくて、labelを削除しようと思ったけど、量が多すぎて萎えて、scriptでやろうと思った コード require 'trello' require 'dotenv' Dotenv.load Trello.configure do |config| config.consumer_key = ENV['TRELLO_CONSUMER_KEY'…
Class import Foundation class Myclass { let msg:String let name:String? init(msg:String = "hello") { self.msg = msg self.name = nil } init(msg:String = "hello", name:String) { self.msg = msg self.name = name } func hello() { var helloMsg:S…
関数定義 func dice() -> Int { let num = 1 + arc4random_uniform(6) return Int(num) } // メソッド定義(戻り値がない関数をメソッドと呼ぶ) func hello() { print("hello") } or func hello() -> Void { print("hello") } guard-else ( 条件を満たさな…
Tuple ( タプル ) let product: (String, Int) = ("Swift", 2015) let kingaku = (1000, 80) // 型推論で(Int, Int)に決まる kingaku = (1060, "hoge") // error: cannot call value of non-function type '(Int, Int)' let data = (1000, 80) let (price, _…
statement 区切りは、; か改行 ; 付けないことが一般的 print print("blue", "green", separator: "+", terminator: ",") print("yellow", terminator: ",") print("red") // blue+green,yellow,red print(#file) // MyPlayground.playground print(#line) /…
Swiftの変数・定数はnilが発生しないようになっていて、nilを代入したい変数は、型をOptional型にする必要がある。 String?のように型の後ろに?をつけるとnilを代入できるOptional型にWrapされる let nums = [3, 4, 6] let lastNum = nums.last let ans = la…
Xcode --- shortcut New Project command + shift + n New Playground option + command + shift + n Tool Bar command + option + t Navigation command + 0 Debug Area shift + command + y Utility Area command + option + 0 Modify Indentation ctrl + …
s3にあるオブジェクトの総量を見たい時 $ aws s3 ls --summarize --human-readable --recursive s3://<backet name> --- Total Objects: 21887 Total Size: 2.7 GiB s3にディレクトリを同期 $ aws s3 sync <local path> s3://<s3 backet> --exact-timestamps reference from http://www.task-note</s3></local></backet>…
chromeでdebugするときどういう機能を使ってデバックしていますでしょうか?自分は基本、debugger とconsoleくらいしか使っていません。この記事では、目についたやってなかったchromeのデバッグ手法を随時追記していきます。 条件的breakpoint source panel…
最近いろいろvueとかreactとか触っているときにそもそも自分はJavascriptがわかっているのかと不安になったので、以下のチュートリアルをやってみた。なんとなくわかるけど、明確に言語化できていなかったところをまとめた。 javascript.info Strict mode wh…
vimで複数行の先頭に文字列追加 Ctrl + v -> 該当の行頭選択 -> Shift + i -> 文字列追加 -> ESC reference from http://itengine.seesaa.net/article/442698942.html
$ node inspect index.js reference from https://nodejs.org/api/debugger.html
install Install with npm globally: $ npm install --global mocha npm install --save-dev mocha mocha とは Mocha is a feature-rich JavaScript test framework テスト全体を取りまとめて管理したり、画面に表示したりするためのもの chaiとの違い chai…
user 確認 $ cat /etc/passwd linux log確認 $ cat /var/log/secure directory内のファイル数確認 $ ls -U1 | wc -l ref https://orebibou.com/2015/06/linux%E3%81%A7%E3%83%A6%E3%83%BC%E3%82%B6%E3%81%AE%E8%BF%BD%E5%8A%A0%E3%83%BB%E5%89%8A%E9%99%A4%E…
Bootstrapとは? the world’s most popular framework for building responsive, mobile-first sites 要は結構有名なCSS framework frameworkと、design pattern (atomic designとか) Design pattern is a category of patterns that deals with object orie…