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
//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
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
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
var IOReqEv = require('socket.io-reqev'); | |
var ioReqEv = new IOReqEv(require('socket.io').listen(50000)); | |
var Timer = require('./timer'); | |
ioReqEv.register("/timer",new Timer()); | |
//temporary web server | |
var static = require('node-static'); | |
var file = new static.Server('.'); | |
require('http').createServer(function (request, response) { | |
request.addListener('end', function () { | |
file.serve(request, response); |
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 events = require('events'); | |
var Timer = function(){ | |
this.events = ["five","ten","thirty"]; | |
var that = this; | |
setInterval(function (){ | |
var now = new Date(); | |
if(now.getSeconds() % 5 == 0){ | |
that.emit("five", {time: now.toString()}); | |
} | |
if(now.getSeconds() % 10 == 0){ |
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> | |
<script type="text/javascript" src="js/jquery.js"></script> | |
<script type="text/javascript" src="js/underscore.js"></script> | |
<script type="text/javascript" src="js/backbone.js"></script> | |
<script type="text/javascript" src="js/socket.io.min.js"></script> | |
<script type="text/javascript" src="js/io-reqev-client.js"></script> | |
<title>sample</title> | |
</head> |
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
def calc_month(t,n) | |
y = t.year | |
m = t.month + n | |
if m < 1 | |
y += ((m-1)/12).floor | |
m = 12 + (m % -12) | |
elsif m > 12 | |
y += (m/12).floor | |
m = ((m-1) % 12) + 1 | |
end |
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
function! ReadJSFile() abort | |
let s:currentPos = col('.') | |
let s:colNum = s:currentPos - 1 | |
let s:lastPos = len(getline('.')) | |
let s:fileName = '' | |
while s:colNum > -1 | |
if getline('.')[s:colNum] =~ "\['\"\]" | |
break | |
end |