This file contains 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
var _ = require('underscore.string'); | |
function convert(string) { | |
var list = string.split('_'); | |
var text = ''; | |
list.forEach(function(string) { | |
text += _.capitalize(string, true); | |
}); | |
return text; |
This file contains 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
package main | |
import "fmt" | |
func main() { | |
jobs := make(chan int, 5) | |
done := make(chan bool) | |
go func() { | |
for { | |
j, more := <-jobs |
This file contains 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
//実態参照テーブル | |
var entity = { | |
quot: '"', | |
lt: '<', | |
gt: '>' | |
}; | |
//deentityifyメソッドを返す | |
return function() { |
This file contains 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
node.jsのコードをかきはじめた際に、httpモジュールを使ったサーバへのHTTP通信を行うコードを書くと思います。 | |
そのときに、requestオブジェクトに対するイベントリスナーをうっかり書き忘れると以下のエラーが出てきます | |
httpサーバーに対してクライアントとしてHTTP通信するhttpClient.jsを実行したときのエラー | |
よく見かけていたけど意味がわかっていなかった | |
つまり、サーバーにリクエストしたけど、エラーが返った時の処理を書いていなかったため、このエラーがでた | |
This file contains 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
X=set('test') | |
Y=set(['h','e','t','p','o']) | |
X,Y | |
X&Y | |
X|Y | |
X - Y |
This file contains 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
boolean flag = false; | |
for(int i=0; i< data.length&&!flag;i++) { | |
if(data[i] == target) { | |
flag = true; | |
} | |
} | |
return flag; | |
} | |
public static boolean find2(int[] data,int target) { |
This file contains 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
private boolean[] divineBooleanList(boolean[] masterList,int startNumber,int finishNumber) { | |
int count = finishNumber-startNumber+1; | |
boolean[] divineList = new boolean[count]; | |
for(int i = startNumber ;i < finishNumber ;i++) { | |
divineList[i-startNumber] = masterList[i]; | |
} | |
return divineList; | |
} |