アロー関数とfunction(){}構文は同じ。アロー(=>)を使って書いたほうが直感的かな?
[1,2,3,4].map(function(x) {return x * x}) // [1,4,9,16]
[1,2,3,4].map(x => x * x) // [1,4,9,16]Rubyだと、
Extensionsを開く@category:"language packs"を入力Japanese Language Pack for VS Codeを見つけてInstallをクリック| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| require 'json' | |
| query_table = [ | |
| ["api_key", ""], # https://www.flickr.com/services/appsでアプリを作成しapiキーを入手してください | |
| ["method", "flickr.photos.search"], | |
| ["tags", "soviet,russia"], # タグをコンマ区切りで指定します | |
| ["tag_mode", "all"], # anyを指定すると「または」、allを指定すると「かつ」 |
| curl "https://www.dl.ndl.go.jp/api/iiif/1184132/manifest.json" | jq .sequences[].canvases[].images[].resource.'"@id"' > output.list |
| # snippets for Rust(.rs) | |
| # install snipMate to your Vim and copy this file to $HOME/.vim/snippets | |
| # version 2019/12/07 | |
| # © Copyright 2019 YUUKIToriyama. All Rights Reserved. | |
| snippet use | |
| use ${1:library}; | |
| snippet fn | |
| fn ${1:func_name}() { | |
| ${2} |
| echo "よいお年を" | sed 's/./&\n/g' | xargs -I@ convert -size 100x100 xc:White -fill Black -font "Takao明朝" -pointsize 100 -gravity Center -draw 'text 0,0 "@"' ubrl: | grep -v : > yoi_otoshi_wo.txt |
| #!/usr/bin/env lua | |
| function calcPi(m) | |
| local count = 0 | |
| for i = 1, m do | |
| x, y = math.random(), math.random() | |
| if x^2 + y^2 < 1 then | |
| count = count + 1 | |
| end | |
| end |
| /* generateRandomColorcode.js */ | |
| function generateRandomColorcode() { | |
| var str = ""; | |
| for (var i = 0; i < 6; i++) { | |
| str = str + Math.round(Math.random()*15).toString(16); | |
| } | |
| return "#" + str | |
| } |