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
console.log("background"); | |
chrome.browserAction.onClicked.addListener(function(tab) { | |
chrome.tabs.create({ | |
'url': chrome.extension.getURL('popup.html') | |
}, function(tab) { | |
// Tab opened. | |
}); | |
}); |
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
/** | |
QRCode Scanner library | |
https://gist.github.com/akirattii/35b033000cd4479c337ae5abb09d7429 | |
@author: akirattii <tanaka.akira.2006@gmail.com> (http://mint.pepper.jp) | |
@dependencies: | |
+ jquery | |
+ jsQR (https://github.com/cozmo/jsQR/) | |
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
const el = document.qeurySelector("#input-x"); | |
// Fire `input` event: | |
el.dispatchEvent(new Event('input', { | |
'bubbles': true, | |
'cancelable': true | |
})); | |
// or |
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
/* | |
Run server by forever with `--killSignal=SIGTERM`: | |
``` | |
$ forever --killSignal=SIGTERM start ./server.js | |
``` | |
Now `gracefulShutdown` function is called when you stop the server by `forever stop`: | |
``` |
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
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
// Deprecated!!! 2018-04-27 | |
// recommends HTML5 validator of Bootstrap (v4.1.0) instead. | |
// https://getbootstrap.com/docs/4.0/components/forms/#validation | |
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
/* | |
Simple Form Validator | |
@dependencies: vue.js, bootstrap4 | |
@see: https://gist.github.com/akirattii/83937626062fc38f8f1ac5c91f172e72 |
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
// | |
// An example of a bitcoind JSON RPC request. | |
// | |
// Example request of curl: | |
// $ curl --data-binary '{"jsonrpc": "1.0", "id":"hoge", "method": "getblockhash", "params": [9999] }' http://rpc:rpc@127.0.0.1:18332/ | |
// | |
const URL = "http://rpc:rpc@127.0.0.1:18332"; // bitcoind testnet. user:"rpc", password:"rpc" | |
const RpcClient = require("./rpc-client.js"); |
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
-- https://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database | |
mysql> | |
SELECT table_schema | |
"DB Name", | |
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" | |
FROM information_schema.tables | |
GROUP BY table_schema; | |
-- RESULT: | |
-- +-----------------------+---------------+ |
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 express = require('express'); | |
var app = express(); | |
var fs = require('fs'); | |
app.get('/', function(req, res) { | |
res.send("hello"); | |
// Notice: Make any uncaughtException happend on purpose | |
fs.readFile('no_such_file.txt', function(err, data) { | |
if (err) throw err; | |
console.log(data); |
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
const cluster = require('cluster'); | |
const numCPUs = require('os').cpus().length; | |
// | |
// ** SharedMemory which is shared among every worker: | |
// | |
// dont use `var` | |
SharedMemory = { | |
// shared data: |
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
/** application error base */ | |
module.exports.AppError = class AppError extends Error { | |
constructor(message) { | |
super(message); | |
this.name = this.constructor.name | |
Error.captureStackTrace(this, this.constructor); | |
} | |
}; | |
// |