Skip to content

Instantly share code, notes, and snippets.

View kobachi's full-sized avatar

kobachi kobachi

View GitHub Profile
@kobachi
kobachi / suggest.js
Last active August 29, 2015 14:04
Suggest Event for JavaScript
(function(){
window.addEventListener("DOMContentLoaded", function(){
var timers = {};
document.body.addEventListener("keyup", function(ev){
var e = ev.target;
if(e.tagName.toLowerCase() != "input" || e.getAttribute("type") != "text"){
return;
}
if(typeof timers[e] == "number" && timers[e] != -1){
clearTimeout(timers[e]);
@kobachi
kobachi / scrollinout.js
Created July 22, 2014 11:35
JavaScript scrollin/scrollout Event Implementation
(function(){
var showns = [];
if(typeof showns.contains != "function"){
if(typeof showns.indexOf == "function"){
showns.contains = function(o){
return 0 <= this.indexOf(o);
};
}
else{
@kobachi
kobachi / Font_Style_Disabler.js
Last active August 29, 2015 14:04
Font Style Disabler
// ==UserScript==
// @name Font Style Disabler
// @namespace kobachi
// @include http://*
// @include https://*
// @version 1.0
// @grant none
// ==/UserScript==
window.addEventListener("load", function(){
@kobachi
kobachi / IP.js
Created August 8, 2014 09:22
[WSH] Shows IP Address
var wmi = GetObject("winmgmts:\\\\.\\root\\cimv2");
var conf = wmi.ExecQuery("select * from Win32_NetworkAdapterConfiguration");
var summary = new Object();
for(var _c = new Enumerator(conf); !_c.atEnd(); _c.moveNext()){
var c = _c.item();
if(!c.IPEnabled){
continue;
}
var ips = c.IPAddress.toArray();
if(ips.length == 0){
@kobachi
kobachi / RegExpParser.js
Last active August 29, 2015 14:05
Extracts groups from regular expression
(function(){
var undefined;
function Group(start, end, nest){
this.start = start;
this.end = end;
this.nest = nest;
this.pattern = undefined;
}
Group.prototype.toString = function(){
return this.pattern;
@kobachi
kobachi / kb_check_2014-08.wsf
Last active August 29, 2015 14:05
2014 年 8 月 13 日公開の更新プログラムの適用により問題が発生する場合がある───の対象KBがインストールされているか検出します。
<job>
<script language="JScript">
(function(){
var sh = WScript.CreateObject("WScript.Shell");
var installedKBs = [];
var wmic = sh.Exec("wmic qfe");
while(wmic.Status != 1){
@kobachi
kobachi / addEventListener.js
Created December 1, 2014 06:48
addEventListener with EventList tracking
(function(){
var addEventListener = Element.prototype.addEventListener;
var removeEventListener = Element.prototype.removeEventListener;
var eventHandlers = new Object();
Element.prototype.addEventListener = function(){
if(typeof eventHandlers[this] == "undefined"){
eventHandlers[this] = {};
}
var e = arguments[0].toLowerCase();
if(typeof eventHandlers[this][e] == "undefined"){
@kobachi
kobachi / FormatJSON-node.hidemaru.mac
Last active September 7, 2021 06:21
JSONを整形する
//選択された範囲のテキストをJSONとして整形する秀丸エディタ用マクロ(要node.js 必要ならnode.exeをフルパスで指定すること。)
runex "node -e \"var data = '';process.stdin.setEncoding('utf8');process.stdin.on('data', function(d){data = data + d;});process.stdin.on('end', function(){console.log(JSON.stringify(JSON.parse(data), null, '\t'));});process.stdin.resume();\"",
1,
5, "",
6, "",
0, "",
4, "",
2,
1,
6;
@kobachi
kobachi / WidthNormalization.tsv
Created February 16, 2015 08:28
Unicode Normalization
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
FF01 ! 0021 !
FF02 " 0022 "
FF03 # 0023 #
FF04 $ 0024 $
FF05 % 0025 %
FF06 & 0026 &
FF07 ' 0027 '
FF08 ( 0028 (
FF09 ) 0029 )
FF0A * 002A *
@kobachi
kobachi / boot2docker-cli.cmd
Last active August 29, 2015 14:15
Boot2Docker Minimum CLI
@echo off
setlocal
title boot2docker-cli
if not exist "%USERPROFILE%\.boot2docker" mkdir "%USERPROFILE%\.boot2docker"
call :SETUP_PATH
call :VERSION_CHECK
if not exist "%USERPROFILE%\.boot2docker\boot2docker.exe" call :DOWNLOAD_CLI
if not exist "%USERPROFILE%\.boot2docker\boot2docker.iso" call :DOWNLOAD_ISO
call :LAUNCH
goto EOF