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
require 'yaml' | |
require 'logger' | |
RAILS_ENV = ENV["RAILS_ENV"] || "development" | |
ROOT = File.dirname(File.expand_path("../",__FILE__)) | |
DB_SETTING = YAML.load_file(ROOT + "/config/database.yml")[RAILS_ENV] | |
class DataBaseWrapper | |
attr_reader :client | |
def initialize(log = Logger.new(STDOUT)) | |
@log = log | |
case DB_SETTING["adapter"] |
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
Weapons = ['a','c', 'e', 'g', 'i', 'k'] | |
class Monster | |
@Weak = | |
'B': 'a' | |
'D': 'c' | |
'F': 'e' | |
'H': 'g' | |
'J': 'i' | |
'L': 'k' |
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
//3月の第2日曜日 | |
function summerTimeStart(y){ | |
var first = new Date(y,2,8); | |
var i = 9; | |
while(first.getDay() != 0){ | |
first = new Date(first.setDate(i++)); | |
} | |
return first; | |
} | |
//11月の第1日曜日 |
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
require('./lib/compiled'); | |
app.configure('development', function(){ | |
var Mincer = require('mincer'); | |
var environment = new Mincer.Environment(); | |
environment.appendPath(__dirname + '/app/assets/javascripts'); | |
app.use('/assets', Mincer.createServer(environment)); | |
ASSET_JS_PATH = null | |
}); | |
app.get('/', index); |
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
function getPort(host,port,maxPort,callback) { | |
var net = require('net'); | |
var socket = new net.Socket(); | |
socket.on('error', function(e) { | |
if(e.code == 'ECONNREFUSED'){ | |
callback(null, port); | |
return; | |
} | |
loop(++port); | |
}); |
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
function zp(num){ | |
return(num < 10 ? "0"+num.toString() : num.toString()); | |
} | |
function toISODate(d){ | |
return ISODate(d.getUTCFullYear() + "-" + zp(d.getUTCMonth() + 1) + "-" + zp(d.getUTCDate()) + "T"+zp(d.getUTCHours()) + ":" + zp(d.getUTCMinutes()) + ":" + zp(d.getUTCSeconds())); | |
} | |
function before(n){ | |
return toISODate(new Date(Date.now() - n * 1000)); | |
} | |
//accessコレクションのTimeフィールドのDataが600秒(10分)以内のレコードを検索 |
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
app.use(express.session()); | |
app.use(express.csrf()); | |
app.get('/', index); | |
index = function(req,res,next){ | |
res.render('index',{token: req.session._csrf}); | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script type="text/javascript" src="http://underscorejs.org/underscore-min.js"></script> | |
<script type="text/javascript" src="https://raw.github.com/LearnBoost/socket.io-client/master/dist/socket.io.min.js"></script> | |
<script type="text/javascript" src="http://backbonejs.org/backbone-min.js"></script> | |
<script type="text/javascript"> | |
jQuery(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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script type="text/javascript" src="http://underscorejs.org/underscore-min.js"></script> | |
<script type="text/javascript" src="https://raw.github.com/LearnBoost/socket.io-client/master/dist/socket.io.min.js"></script> | |
<script type="text/javascript" src="http://backbonejs.org/backbone-min.js"></script> | |
<script type="text/javascript"> | |
var ExampleModel = Backbone.Model.extend({ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script type="text/javascript" src="http://underscorejs.org/underscore-min.js"></script> | |
<script type="text/javascript" src="https://raw.github.com/LearnBoost/socket.io-client/master/dist/socket.io.min.js"></script> | |
<script type="text/javascript" src="http://backbonejs.org/backbone-min.js"></script> | |
<script type="text/javascript"> | |
var ExampleRouter = Backbone.Router.extend({ |