Skip to content

Instantly share code, notes, and snippets.

@yukisov
yukisov / index.html
Created August 3, 2017 08:40
requestAnimationFrame が呼び出される間隔を測定する
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>requestAnimationFrame が呼び出される間隔を測定する</title>
<style>
h4 {
margin-bottom: 0;
@yukisov
yukisov / .ctags
Created October 28, 2016 05:48
JavaScriptのための .ctags ファイル (https://gist.github.com/tim-smart/199338 が削除されると困るのでコピーした)
--langdef=js
--langmap=js:.js
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\{/\5/,object/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\5/,function/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\[/\5/,array/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[^"]'[^']*/\5/,string/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*(true|false)/\5/,boolean/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[0-9]+/\5/,number/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*.+([,;=]|$)/\5/,variable/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*[ \t]*([,;]|$)/\5/,variable/
@yukisov
yukisov / routine_on_login.sh
Last active April 28, 2016 09:31
Linuxサーバにログインした直後に行うチェック項目をshファイルにした。
#!/usr/bin/sh
# ログイン直後にチェックする項目
# cf. [Linuxサーバにログインしたらいつもやっているオペレーション - ゆううきブログ](http://yuuki.hatenablog.com/entry/linux-server-operations)
for CMD in w 'last -n5' uptime 'ip a' 'df -Th'
do
echo ':::::::::::::::::::'
echo ":: $" $CMD
echo ':::::::::::::::::::'
$CMD
@yukisov
yukisov / makepassword.js
Created March 14, 2016 05:07
JavaScriptでパスワードを生成する。
/**
* Make password
*
* Usage:
* $ node makepassword.js 10
*/
"use strict";
let length = 20;
if (process.argv.length >= 3 && isNaN(process.argv[2]) == false) {
@yukisov
yukisov / POIsFileCreationTest.java
Last active October 8, 2015 08:40
Apache POI で同じファイルを簡単に作ってみる。
...
@Test
public void testPoiFileCopy() {
String inputFile = "test/input/データ.xls"; // 入力ファイル
String outputFile = "test/output/データ2.xls"; // 出力ファイル
try {
FileInputStream fis = new FileInputStream(inputFile);
HSSFWorkbook wb = new HSSFWorkbook(fis);
module.exports = {
// configuration
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader"
}
],
@yukisov
yukisov / .eslintrc
Last active August 29, 2015 14:28
ESLint configuration file
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"ecmaFeatures": {
"modules": true
},
"extends": "eslint:recommended",
/**
* モバイル環境であるかどうかを返す。
* @return {boolean}
*/
function isMobile() {
if (typeof global.navigator === 'undefined') {
return false;
}
return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(global.navigator.userAgent));
}
@yukisov
yukisov / ssh_commands_on_remote_host.php
Created December 11, 2014 05:57
Execute multiple commands on a remote host through ssh
<?php
namespace Yukisov;
class SshCommunicatorException extends \Exception
{
public function __construct($message, $code = 0, \Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
public function __toString() {
@yukisov
yukisov / composer.json
Created December 8, 2014 05:21
Common composer.json
{
"name": "my-app",
"description": "",
"keywords": [],
"license": "MIT",
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpmd/phpmd" : "@stable"
},
"require": {