Skip to content

Instantly share code, notes, and snippets.

View yukidarake's full-sized avatar
🎯
Focusing

Toshiyuki Nakamura yukidarake

🎯
Focusing
View GitHub Profile
@yukidarake
yukidarake / stream_example.js
Created August 18, 2012 08:30
node.jsで標準出力から一行ずつ読み込んでファイルに書きこむ例
var fs = require('fs');
var buffer = '';
var out = fs.createWriteStream('test.txt', {
encoding: 'utf8',
mode: 0644,
});
process.stdin.resume();
process.stdin.setEncoding('utf8');
@yukidarake
yukidarake / .gitignore
Created March 31, 2019 13:15
transpile lit-html to es5
/dist
@yukidarake
yukidarake / type-100million-chars-per-sec.md
Created October 29, 2014 10:01
仕事を高速でこなす方法

秒速で1億字叩く条件

秒速

きっかけ

naoya_itoの火を噴いたシェルtips
http://togetter.com/li/652438

キーリピート高速化

カーソル移動やバックスペースで文字を消すのが速くなります。

@yukidarake
yukidarake / .gitignore
Last active January 13, 2016 11:43
coの使い方
node_modules
@yukidarake
yukidarake / event_loop.js
Created January 12, 2016 06:41
process.nextTickとsetImmediateの違いを理解する
'use strict';
var fs = require('fs');
console.log('start');
fs.readFile('./a.txt', function(err, data) {
console.log('readFile');
process.nextTick(function() {
console.log('readFile -> nextTick');
@yukidarake
yukidarake / fibonacci.js
Created September 19, 2013 04:44
クロージャーを利用してキャッシュすると速いよというテク
function fibonacci1(x) {
if (x < 2) {
return 1;
}
return fibonacci1(x - 1) + fibonacci1(x - 2);
}
var fibonacci2 = (function() {
var cache = {};
@yukidarake
yukidarake / say.pl
Created August 14, 2013 10:07
5.10.0以降でsay使いたい
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
say 'say!';
@yukidarake
yukidarake / macvim-kaoriya.rb
Last active December 21, 2015 01:39
MacVim-Kaoriyaをsnow leopardで入れたときに使ったFormula。 元はこちら https://github.com/splhack/homebrew-splhack brew tap splhack/homebrew-splhack で入れたが、gistの場合もできるだろうか??
require 'formula'
class MacvimKaoriya < Formula
homepage 'http://code.google.com/p/macvim-kaoriya/'
head 'https://github.com/splhack/macvim.git'
depends_on 'cmigemo-mk' => :build
depends_on 'ctags-objc-ja' => :build
depends_on 'gettext-mk' => :build
@yukidarake
yukidarake / jst.pl
Last active December 14, 2015 11:38
Perl5.10以上ならTime::Pieceが標準添付モジュールとなっている。ミリ秒のUNIXタイムをJSTにする。
perl -MTime::Piece -lane 'print localtime(gmtime($F[0]/1000)->epoch)."\t$F[1]"' hoge.log
@yukidarake
yukidarake / gist:4662008
Created January 29, 2013 05:21
行頭のコメントの下に/* jshint unused:false */を加えるというワンライナー。 ポイントは行番号$.をファイルごとにリセットする必要があるので、close ARGV if eofというイディオムを入れてみた。 あと、ackはやっぱり便利。
ack -f lib | xargs perl -i -pe 's#\*/\n#*/\n\n/*jshint unused: false */\n# if $. < 7; close ARGV if eof;'