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
class DocumentTopPosition { | |
constructor(doc, win) { | |
this.document = doc || document; | |
this.window = win || window; | |
} | |
/** | |
* @returns {number} top position | |
*/ | |
get(element) { |
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
class DisplayOutMonitor { | |
constructor(option) { | |
option = option || {} | |
this.document = option.document || document | |
this.interval = option.interval || 100 | |
} | |
/** | |
* @param {string} | |
* @param {(isOut:boolean)=>void} |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /app/silexsample/ | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /app/silexsample/index.php [L] | |
</IfModule> |
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 | |
function lock($lockFileName, $fuc) { | |
if(!file_exists($lockFileName)) { | |
file_put_contents($lockFileName, ''); | |
} | |
$lock_fp = fopen($lockFileName ,"w"); | |
flock($lock_fp, LOCK_EX); | |
try { | |
return $fuc(); |
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
const template = ` | |
package __PACKAGE__; | |
import lombok.AllArgsConstructor; | |
import lombok.EqualsAndHashCode; | |
@AllArgsConstructor | |
@EqualsAndHashCode | |
public class __CLASS__ { | |
private final String value; |
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
<!DOCTYPE html> | |
<div id="div20180606"> | |
<table border="1"> | |
<tr><th>名前</th><th>備考</th> | |
<tr><td>ほげ</td><td>改行<br>テスト</td></tr> | |
<tr><td>ふー</td><td>改行<br>テスト</td></tr> | |
</table> | |
</div> | |
<script> |
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 . inputfile outRootDir | |
if(process.argv.length == 2) { | |
const msg = 'USAGE\nnode . inputMarkdownFile outRootDir' | |
console.log(msg) | |
throw msg | |
} | |
const inputMarkdownFile = process.argv[2] | |
const outRootDir = process.argv[3] |
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
// 最後に更新されたファイルを取得する | |
// 利用例 | |
// ls -l | node lastupdate.js | |
// => 2018-12-18 10:50 ./worklog/index.js | |
// | |
// サブディレクトリも対象にするならこう | |
// find . -type f | xargs ls -l | node worklog index.js | |
// | |
// 事前準備 | |
// npmで'textpipe'を入れておくこと |
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
/** | |
* レコードの全取得 | |
*/ | |
function findAll(name /* シート名 */) { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(name); | |
var table = sheet.getDataRange().getValues() | |
return JSON.parse(JSON.stringify(table)); | |
} | |
/** |
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
/** | |
* 外部ファイルからjsを読み込む | |
* githubやgists上にあるコードを使いたい時用 | |
*/ | |
function loadLibForOneMethod(mainMethodName, url) { | |
// リトライありのfetch | |
function retryFetch(url) { | |
var lastError = null; | |
for(var i = 0; i < 3; i++) { | |
try { |