Skip to content

Instantly share code, notes, and snippets.

View yorkie's full-sized avatar
🎯
Focusing

Yorkie Makoto yorkie

🎯
Focusing
View GitHub Profile
@yorkie
yorkie / psql.md
Created September 25, 2014 06:16
@yorkie
yorkie / room.js
Created September 6, 2014 14:25
sends all devices with port(10000) in LAN
var dgram = require('dgram');
var assert = require('assert');
var args = process.argv.slice(2);
var port = parseInt(args[0]);
assert.ok(typeof port === 'number');
var dc = dgram.createSocket('udp4');
dc.on('error', function(err) {
@yorkie
yorkie / gscrollbar.css
Created September 6, 2014 09:09
Google Scrollbar Styles
::-webkit-scrollbar {
height: 15px;
width: 15px;
}
::-webkit-scrollbar-button {
height: 0;
width: 0;
}
::-webkit-scrollbar-thumb {
background-clip: padding-box;
::-webkit-input-placeholder {
text-align:center;
}
:-moz-placeholder { /* Firefox 18- */
text-align:center;
}
::-moz-placeholder { /* Firefox 19+ */
text-align:center;
var url = require('url');
var assert = require('assert');
function parse(repo, githubHost) {
githubHost = githubHost || 'github.com'
if (typeof repo === 'object')
return repo.url
var repoObj = url.parse(repo);
@yorkie
yorkie / idle-hands.js
Created August 13, 2014 07:53
idle-hands is not really idle
var request = require('request');
var idlehands = require('idle-hands');
var timerCount = 0;
var idleCount = 0;
function repeat(cb) {
setImmediate(function() {
timerCount += 1;
});
var sinon = require('sinon');
var clock = sinon.useFakeTimer();
setTimeout(function timer() {
console.log('...')
}, 1000);
// if we set:
clock.tick(1000); // timer will be called
@yorkie
yorkie / howto.md
Created August 6, 2014 05:43
update your gcc in centos

update yum config via vi:

$ vi /etc/yum.repos.d/DevToolset.repo

make sure this file is new and paste below block to your terminal:

[DevToolset-2]
name=RedHat DevToolset v2 $releasever - $basearch
import os
from ctypes.util import find_library
from ctypes import CDLL, cast, c_char_p, c_int, c_size_t, c_void_p
_libcfile = find_library('c') or 'libc.so.6'
libc = CDLL(_libcfile, use_errno=True)
_libopenccfile = os.environ.get('LIBOPENCC') or find_library('opencc')
@yorkie
yorkie / show-date.sh
Created July 18, 2014 08:42
how to output the file modify date in git environment
### command-line
git log posts/example.js | awk '/Date/ { print $2, $3, $4, $5, $6; exit; }'
### in script
date = `git log posts/example.js | awk '/Date/ { \
print $2, $3, $4, $5, $6; \
exit; \
}'`