This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (autoload 'js2-mode "js2" nil t) | |
| (add-hook 'js2-mode-hook | |
| #'(lambda () | |
| (require 'espresso) | |
| (setq espresso-indent-level 2 | |
| espresso-expr-indent-offset 2 | |
| indent-tabs-mode nil) | |
| (set (make-local-variable 'indent-line-function) 'espresso-indent-line))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; | |
| ;; JavaScriptについて | |
| ;; | |
| ;; js2-modeを使う | |
| ;; しかしインデントが糞なのでjs-modeの物を使う | |
| (autoload 'js2-mode "js2" nil t) | |
| (setq-default js2-basic-offset 4) | |
| (when (load "js2" t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #リポジトリのルートに飛ぶ | |
| function cdr(){ | |
| cd ../ | |
| if [ -e .git -a -d .git ]; then | |
| return 0 | |
| else | |
| cdr | |
| fi | |
| return 0 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #リポジトリのルートに飛ぶ | |
| function cdr(){ | |
| if [ -e .git -a -d .git ]; then | |
| return 0 | |
| else | |
| cd ../ | |
| cdr | |
| fi | |
| return 0 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| def parse_max(data) | |
| puts "要素数:" + data.size.to_s | |
| max = 0 | |
| max_idx = 0 | |
| data.each_with_index do |val, idx| | |
| val = val.to_f unless val.kind_of? String | |
| if max <= val | |
| max = val | |
| max_idx = idx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # コメントテスト | |
| def parse_max(data) | |
| puts "要素数:" + data.size.to_s | |
| max = 0 | |
| max_idx = 0 | |
| no_increace = 0 | |
| data.each_with_index do |val, idx| | |
| val = val.to_f unless val.kind_of? String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| def parse_max(data) | |
| puts "要素数:" + data.size.to_s | |
| max = 0 | |
| max_idx = 0 | |
| no_increace = 0 | |
| data.each_with_index do |val, idx| | |
| val = val.to_f unless val.kind_of? String | |
| if max <= val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # C言語では こんな感じなのが | |
| # | |
| # int flag = 0 | |
| # do{ | |
| # flag = hoge ? 1 : 0; | |
| # } while (flag); | |
| # | |
| # Rubyでは |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| #実験結果をcsv化するスクリプト | |
| log = Hash.new | |
| Dir.glob("*/log") do |log_path| | |
| key = "N=" + log_path.match(/N_(.*)\/log/).captures[0] | |
| log[key] = Array.new | |
| open(log_path) do |f| | |
| f.read.each_line do |line| | |
| if line =~ /Pred/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 01_というプリフィックスをつけたファイルを用意 | |
| mbp:~ namai$ echo "a" > 01_a | |
| mbp:~ namai$ echo "b" > 01_b | |
| # コピー先のディレクトリを用意 | |
| mbp:~ namai$ mkdir desti | |
| # $ cp 01_* desti/ と打とうとしたら...間違って途中エンター押しちゃった | |
| mbp:~ namai$ cp 01_* | |
| # 中を見るとどっちも同じファイルに・・・ | |
| mbp:~ namai$ cat 01_a | |
| a |