EmacsユーザーのためのVS Code(Windows, キー操作編)

チートシートを見ているだけでは使えるようにならないので、Emacs頭の自分に合わせて整理してみた。 キー操作対応表 説明 Emacs VS Code 備考 カーソル移動 次の文字へ C-f → 前の文字へ C-b ← 次の行へ C-n ↓ 前の行へ C-p ↑ 行頭へ C-a Home 行末へ C-e En…

20分ではじめるRubyPico を読む「ファイルからの読み込み」

説明はなかったが、ファイル作成すると以下のコードが挿入されていた。 puts "Hello, RubyPico!" puts "http://rubypico.ongaeshi.me" puts Image.load("chat_ruby.png") これは消して実行すると irb - Interactive Ruby Shell irb:000> load "greeter" => t…

20分ではじめるRubyPico を読む「複数行にまたがるプログラム」

irb - Interactive Ruby Shell irb:000> def hello; puts "Hello World!"; end => :hello irb:001> hello Hello World! => nil irb:002> def hello line 1: syntax error, unexpected $end, expecting ';' or '\n' irb:003> CRubyだと >> def hello >> puts …

20分ではじめるRubyPico を読む「変数の前には@」

「irbで変数を使うときは@を付ける」 irb - Interactive Ruby Shell irb:000> x = 1 => 1 irb:001> x undefined method 'x' for main irb:002> @x = 1 => 1 irb:003> @x => 1 irb:004> 理由不明

動かしてみる

irb - Interactive Ruby Shell irb:000> 1 + 1 => 2 irb:001>

JScript ランゲージ リファレンス、valueOf メソッド

WScript.Echo([1, 2, 3].valueOf());

JScript ランゲージ リファレンス、UTC メソッド

WScript.Echo(Date.UTC(2012, 6, 26)); WScript.Echo(Date.UTC(1970, 0, 1, 0, 0, 0, 1));

JScript ランゲージ リファレンス、unescape メソッド

WScript.Echo(unescape("*" + "%20" + "*")); WScript.Echo(unescape("%u3042")); // あ

JScript ランゲージ リファレンス、ubound メソッド

まんま <HEAD> <SCRIPT LANGUAGE="VBScript"> <!-- Function CreateVBArray() Dim i, j, k Dim a(2, 2) k = 1 For i = 0 To 2 For j = 0 To 2 a(j, i) = k k = k + 1 Next Next CreateVBArray = a End Function --> </SCRIPT> <SCRIPT LANGUAGE="JScript"> </head>

JScript ランゲージ リファレンス、toUTCString メソッド

WScript.Echo(new Date().toUTCString()); WScript.Echo(new Date().toString());

JScript ランゲージ リファレンス、toUpperCase メソッド

WScript.Echo("abc".toUpperCase());

JScript ランゲージ リファレンス、toString メソッド

WScript.Echo(new Date().toString()); WScript.Echo(true); WScript.Echo(true.toString()); //WScript.Echo(1.toString()); x = 10; WScript.Echo(x.toString()); WScript.Echo(x.toString(2)); WScript.Echo(x.toString(16));

JScript ランゲージ リファレンス、toLowerCase メソッド

WScript.Echo("ABC".toLowerCase());

JScript ランゲージ リファレンス、toLocaleString メソッド

WScript.Echo(new Date().toLocaleString());

JScript ランゲージ リファレンス、toGMTString メソッド

WScript.Echo(new Date().toGMTString());

JScript ランゲージ リファレンス、toArray メソッド

まんま <HEAD> <SCRIPT LANGUAGE="VBScript"> <!-- Function CreateVBArray() Dim i, j, k Dim a(2, 2) k = 1 For i = 0 To 2 For j = 0 To 2 a(j, i) = k document.writeln(k) k = k + 1 Next document.writeln("<BR>") Next CreateVBArray = a End Function --> </SCRIPT> <SCRIPT LANGUAGE="JScript"> </head>

JScript ランゲージ リファレンス、test メソッド

WScript.Echo(/\w/.test("foo")); if (/\w/.test("foo")) { WScript.Echo("then"); } else { WScript.Echo("else"); } WScript.Echo(/\d/.test("foo"));

JScript ランゲージ リファレンス、tan メソッド

WScript.Echo(Math.tan(0)); WScript.Echo(Math.tan(Math.PI/4));

JScript ランゲージ リファレンス、sup メソッド

WScript.Echo("foo".sup());

JScript ランゲージ リファレンス、substring メソッド

substr, substring というちょっと紛らわしい使い分け… WScript.Echo("foo".substring(0,1)); WScript.Echo("foo".substring(1,0)); WScript.Echo("foo".substring(0,0)); WScript.Echo("foo".substring(4,5)); WScript.Echo("foo".substring(-1,1));

JScript ランゲージ リファレンス、substr メソッド

WScript.Echo("foo bar".substr(0)); WScript.Echo("foo bar".substr(1)); WScript.Echo("foo bar".substr(1, 4)); WScript.Echo("foo bar".substr(1, 10)); WScript.Echo("foo bar".substr(10)); WScript.Echo("foo bar".substr(1, -1));

JScript ランゲージ リファレンス、sub メソッド

WScript.Echo("foo".sub());

JScript ランゲージ リファレンス、strike メソッド

WScript.Echo("foo".strike());

JScript ランゲージ リファレンス、sqrt メソッド

WScript.Echo(Math.sqrt(2));

JScript ランゲージ リファレンス、split メソッド

a = "abc def ghi".split(/\s+/); WScript.Echo(a); a = "abc def ghi".split(/\s+/, 1); WScript.Echo(a);

JScript ランゲージ リファレンス、sort メソッド

a = [3, 4, 2, 1] WScript.Echo(a.sort()); WScript.Echo(a); a.sort(function(a, b) { if (a > b) { return -1; } else if (a < b) { return 1; } else { return 0; } }); WScript.Echo(a);

JScript ランゲージ リファレンス、small メソッド

WScript.Echo("foo".small());

JScript ランゲージ リファレンス、slice メソッド(String オブジェクト)

str = "abc" WScript.Echo(str.slice(0)); WScript.Echo(str.slice(1)); WScript.Echo(str.slice(3)); WScript.Echo(str.slice(0,1)); WScript.Echo(str.slice(1,0)); WScript.Echo(str.slice(-1)); WScript.Echo(str.slice(-2,-1)); WScript.Echo(str.slice…

JScript ランゲージ リファレンス、slice メソッド(Array オブジェクト)

a = [1, 2, 3] WScript.Echo(a.slice(0)); WScript.Echo(a.slice(1)); WScript.Echo(a.slice(3)); WScript.Echo(a.slice(0,1)); WScript.Echo(a.slice(1,0)); WScript.Echo(a.slice(-1)); WScript.Echo(a.slice(-2,-1)); WScript.Echo(a.slice(-2)); WScript…

JScript ランゲージ リファレンス、sin メソッド

WScript.Echo(Math.sin(0)); WScript.Echo(Math.sin(Math.PI/2));