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
| wget http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm | |
| yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm | |
| yum install nodejs-compat-symlinks npm | |
| rm nodejs-stable-release.noarch.rpm |
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
| node -v |
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
| node exsample.js |
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
| curl http://127.0.0.1:1377 |
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
| var http = require('http'); | |
| http.createServer(function (req, res) { | |
| res.writeHead(200, {'Content-Type': 'text/plain'}); | |
| res.end('Hello World\n'); | |
| }).listen(1337, '127.0.0.1'); | |
| console.log('Server running at http://127.0.0.1:1337/'); |
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
| <?php | |
| // MongoDBに接続 localhost:27017 | |
| $m = new Mongo(); | |
| // リモートホストにデフォルトポート27017で接続 | |
| // $m = new Mongo("exsample.com"); | |
| //リモートホストに任意のポートで接続(xxxxxはポート番号) | |
| // $m = new mongo("exsample.com:xxxxx"); |
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 -*- | |
| require 'mongo' | |
| #データベースと接続 | |
| connection = Mongo::Connection.new | |
| #connection = Mongo::Connection.new('localhost'); | |
| #connection = Mongo::Connection.new('localhost'27017); | |
| puts 'データベース一覧' |
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
| package jp.mironal.java.app.twittext; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import twitter4j.Status; | |
| import twitter4j.Twitter; | |
| import twitter4j.TwitterException; | |
| import twitter4j.TwitterFactory; | |
| import twitter4j.json.DataObjectFactory; |
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
| var json = JSON.parse(jsonStr); | |
| console.log("json.length = " + json.length); | |
| for( var cnt = 0; cnt < 10; cnt++){ | |
| console.time("inspect"); | |
| for( var i = 0; i < json.length; i++){ | |
| util.inspect(json[i], false, 4); | |
| } | |
| console.timeEnd("inspect"); | |
| } |
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
| process.stdin.resume(); | |
| process.stdin.setEncoding('utf8'); | |
| // stdinがなんか読み込んだ時に呼ばれる. | |
| process.stdin.on('data', function(chunk){ | |
| //実際のchunkは予期せぬ位置で細切れに入ってくる. | |
| chunk.split('\n').forEach(function(){ | |
| // 何か処理 | |
| }); | |
| }); |