ls /path/to/logs/* -d | tail -n 1
こんな感じで時系列にならんだログファイルから
最新のファイルの絶対パスを取得します。
log20150101.txt
log20150102.txt
var getQuery = function() { | |
var result = {}; | |
if(location.href.indexOf('?') == -1) return result; | |
var lastIndex = location.href.indexOf('#') != -1 ? location.href.indexOf('#') : location.href.length; | |
var kvs = location.href.slice(location.href.indexOf('?') + 1, lastIndex).split('&'); | |
for(var i = 0; i < kvs.length; i++) { | |
var kv = kvs[i].split('='); | |
result[kv[0]] = kv[1]; | |
} | |
return result; |
var MD5 = function() { | |
var crypto = require('crypto'); | |
return { | |
hex: function(src) { | |
var md5 = crypto.createHash('md5'); | |
md5.update(src, 'utf8'); | |
return md5.digest('hex'); | |
} | |
}; | |
}; |
Copyright [yyyy] [name of copyright owner] | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, |
# example | |
# fab -H [hostname] -u [user] -i [pubkey] deploy:[work dir] | |
from fabric.api import cd, run | |
def deploy(dir): | |
with cd (dir): | |
run("ls") | |
run("git pull") | |
run("npm install") | |
run("sh stop.sh") |
ls /path/to/logs/* -d | tail -n 1
こんな感じで時系列にならんだログファイルから
最新のファイルの絶対パスを取得します。
log20150101.txt
log20150102.txt
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'phaser-area'); | |
var fish; | |
game.state.add('main', { | |
preload: function() { | |
game.stage.backgroundColor = '#ffffdd'; | |
// 魚の画像をロード | |
game.load.image('fish', '../../common/img/fish.png'); | |
}, | |
create: function() { | |
var segmentWidth = 400 / 10; |
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'phaser-area'); | |
var player; | |
var coinGroup; | |
var cursors; | |
var playerSpeed = 3; | |
game.state.add('main', { | |
preload: function() { | |
game.stage.backgroundColor = '#ffffdd'; | |
game.load.image('player', '../../common/img/buta2.png'); | |
game.load.image('coin', '../../common/img/coin.png'); |
var divList = document.querySelectorAll('div'); | |
var a = divList[0];// 1つ目の要素 | |
var b = divList[1];// 2つ目の要素 |
'use strict'; | |
var app = require('app'); | |
var BrowserWindow = require('browser-window'); | |
require('crash-reporter').start(); | |
app.on('window-all-closed', function() { | |
if (process.platform != 'darwin') app.quit(); | |
}); | |
app.on('ready', function() { |
interface Either<L, R> { | |
default Optional<L> left() { return Optional.empty(); } | |
default Optional<R> right() { return Optional.empty(); } | |
static <L, R> Either<L, R> left(L left) { | |
Optional<L> leftValue = Optional.ofNullable(left); | |
if(!leftValue.isPresent()) throw new NullPointerException("left value is null"); | |
return new Either<L, R>() { | |
@Override | |
public Optional<L> left() { | |
return leftValue; |