Code Archive Skip to content Google About Google Privacy Terms
みんなのIoT/みんなのPythonの著者。二子玉近く160平米の庭付き一戸建てに嫁/息子/娘/わんこと暮らしてます。月間1000万PV/150万UUのWebサービス運営中。 免責事項 プライバシーポリシー Web開発で,Pythonのコードをクライアントサイド(Webブラウザ)でダイナミックに実行したいというニーズはけっこうあると思う。 pystachio(ピスタチオ)はユニークなアプローチでPythonのコードをWebブラウザ上で実行する仕組みだ。Pythonのコードを,JavaScriptを使ってダイナミックにPythonのコードに変換して実行する,というもの。開発者はHTMLなどにPythonのコードを埋め込むだけでいい。あとはpystachioがPythonのコードをJavaScriptに変換して,実行してくれる。 まずは <script type="text/javascrip
split の研究 split 関数の挙動が言語ごとに微妙に異なると知人と話題になったので調べてみました。結果はまとめをどうぞ。 Ruby まずはRubyから調べてみます。irb を使って調べました。 % irb ... まずは普通に分割 >> "a,b,c".split(",") => ["a", "b", "c"] 末尾に空要素があると、省略されてしまう >> "a,,c,,".split(",") => ["a", "", "c"] 末尾の空要素を省略しないためには -1 が必要 >> "a,,c,,".split(",", -1) => ["a", "", "c", "", ""] 空文字列だと結果も空 >> "".split(",") => [] -1 をつけても同様 >> "".split(",", -1) => [] 分割パターンを指定しない場合も同様 >> "".split
Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at
文字列操作の比較表: Ruby, Python, JavaScript, Perl, C++ Ruby, Python, JavaScript, Perl, C++ の文字列操作の比較表を作りました。配列操作の比較表の続編です。間違いなどがあったらご指摘いただけると助かります。 Ruby (String) Python (str) JavaScript (String) Perl C++ (std::string)
配列操作の比較表: Ruby, Python, JavaScript, Perl, C++ プログラムを書いていると、他のプログラミング言語の記憶とごっちゃになって、「配列の後ろに要素を追加するのは push だっけ、 append だっけ」などと混乱することがあります。特に Ruby, Python, JavaScript はコードの書き方が似ているので、この問題が起きがちです。 そこで、備忘録として、 Ruby, Python, JavaScript, Perl, C++ の配列操作の比較表を作りました。一番慣れている Ruby を基準にしています。間違いなどがあったらご指摘いただけると助かります。他の言語のもあるといいなあ。 Ruby (Array) Python (list) JavaScript (Array) Perl (@) C++ (std::vector)
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く