Skip to content

Instantly share code, notes, and snippets.

View okunishinishi's full-sized avatar

Taka Okunishi okunishinishi

View GitHub Profile
@okunishinishi
okunishinishi / test-to_zenkaku_filenames.js
Last active December 29, 2015 03:49
ディレクトリ内のファイル全てを、拡張子以外全角に変換する。  例)勤怠表_T01234_奥西.excel => 勤怠表_T01234_奥西.txt
#!/bin/env node
var exec = require('child_process').exec,
fs = require('fs'),
path = require('path'),
here = process.cwd();
(function (bin_name) {
var resolve = path.resolve,
@okunishinishi
okunishinishi / setup_npm inside proxy
Created November 27, 2013 01:29
社内でgitやnpmを使うときの設定
git config --global http.proxy http://myproxy:8080
git config --global https.proxy https://myproxy:8080
npm config set proxy http://myproxy:8080
npm config set https-proxy https://myproxy:8080
npm config set registry http://registry.npmjs.org/
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@okunishinishi
okunishinishi / file0.js
Last active August 29, 2015 14:23
npmのパッケージをpublishするついでにversion番号のインクリメントとGithubのTag切りまでやってくれるスクリプトを書く ref: http://qiita.com/okunishinishi@github/items/47e1c1d544de6e72752b
#!/usr/bin/env node
/**
* Version up this package.
*/
"use strict";
@okunishinishi
okunishinishi / file0.js
Created July 25, 2015 08:49
JavaScriptの関数で、可変長・任意の引数をいい感じに処理する ref: http://qiita.com/okunishinishi@github/items/d6f3cffa58ef480c4af7
doSomething('foo')
doSomething('foo','bar')
doSomething('foo','bar', 'baz');
doSomething('foo','bar', {verbose:true});
doSomething('foo','bar', function done(){/*...*/})
doSomething('foo','bar', {verbose:true}, function done(){/*...*/})
@okunishinishi
okunishinishi / file0.txt
Created July 30, 2015 13:29
bowerから必要なファイルだけとってきて必要な場所に配置するようにする ref: http://qiita.com/okunishinishi@github/items/7be00d641930481ba376
$ bower install jquery
@okunishinishi
okunishinishi / file0.txt
Created August 8, 2015 03:38
Node.jsでのメッセージリソース管理を考える ref: http://qiita.com/okunishinishi@github/items/68b3c8e12ea8f5741387
{
"TITLE": "オクニシタカドットコム",
"WELCOME_MESSAGE": "オクニシタカドットコムへようこそ"
}
@okunishinishi
okunishinishi / file0.txt
Created August 8, 2015 06:47
package.jsonのdependenciesを自動更新するスクリプトを書く ref: http://qiita.com/okunishinishi@github/items/7629b58d1c3d464738dc
"dependencies":{
"async":"*",
"glob":"latest"
}
$ cp src/*.html dest
@okunishinishi
okunishinishi / file0.js
Created August 8, 2015 14:56
Node.jsのテストで特定の関数をモックと置き換える ref: http://qiita.com/okunishinishi@github/items/fe22839a72a5717a4982
// nodeunitのテストケース
exports.setUp = function(done){
// console.logを何もしない関数と置き換える
console.log = function noop() {
}
done();
};