Skip to content

Instantly share code, notes, and snippets.

View ymkjp's full-sized avatar
:shipit:
while true

Kenta Long Yamamoto ymkjp

:shipit:
while true
View GitHub Profile
@ymkjp
ymkjp / mysql_soket.sh
Last active December 18, 2015 07:19
How to check mysql socket's path
$ mysql_config --socket
@ymkjp
ymkjp / gist:5745991
Last active December 18, 2015 07:19
How to kill WEBrick process
$ ps x | grep ruby
$ kill -KILL 12801
@ymkjp
ymkjp / de_entity.js
Created May 31, 2013 03:55
今日こういうコード片を見て感銘を受けた。 /g オプション付きの replace メソッドで第2引数に function を使う。 その第1引数 a には正規表現に合致した文字列全体が、第2引数 b にはキャプチャした文字列が渡っている。 引用は『JavaScript Good Parts』から。サンプルが良質。
function () {
var entity = {
quot: '"',
lt: '<',
qt: '>'
};
return function () {
return this.replace(/&([^&;]+);/g,
function (a, b) {
var r = entity[b];
@ymkjp
ymkjp / dotfiles.sh
Last active December 16, 2015 04:29 — forked from sonots/dotfiles.sh
#!/bin/sh
[[ -e ~/.dotfiles ]] || git clone [email protected]:ymkjp/.dotfiles.git ~/.dotfiles
pushd ~/.dotfiles
git submodule init
git submodule update
for i in `ls -a`
do
[ $i = "." ] && continue
(function(){
for (var n = 1; n<=100; n++){
if(n%3 == 0 && n%5 == 0){console.debug("FizzBuzz")}
else if(n%3 == 0){console.debug("Fizz")}
else if(n%5 == 0){console.debug("Buzz")}
else console.debug(n);
}
})();
@ymkjp
ymkjp / n_step_fibonacci.php
Last active December 12, 2015 02:18
n-Step Fibonacci numbers
<?php
$end = 1000; // Set the end of number here
$step = 4; // Set the step of Fibonacci, in this script it's set as tetranacci numbers
$arr = array();
$nacci;
if ($step < 2) {
trigger_error('ERROR: $step must be 2 or greater.', E_USER_ERROR);
@ymkjp
ymkjp / Keyconfig_hatena.html
Created January 8, 2013 17:00
Keyconfig (Chrome Extension) の設定 | Did you mean: Kenta YAMAMOTO http://ymkjp.blogspot.jp/2013/01/keyconfig-chrome-extension.html
<a href="%URL%" target="_blank">%TITLE%</a><img src>"http://b.hatena.ne.jp/entry/image/%URL%" alt="%TITLE% - はてなブックマーク" title="%TITLE% - はてなブックマーク">
@ymkjp
ymkjp / kindlize-it_sendrequest.js
Created November 26, 2012 09:54
To test closure
(function () {
"use strict";
var ContentScripts = (function () {
function isBook(category) {
if (category.value === "books") {
return true;
}
return false;
}
@ymkjp
ymkjp / backup_books.dat
Created November 24, 2012 15:02
tar.bz2 でバックアップしてた電子書籍の解凍がこけたときの作業ログ
bzip2: Compressed file ends unexpectedly;
perhaps it is corrupted? *Possible* reason follows.
bzip2: Undefined error: 0
Input file = books.tar.bz2, output file = (stdout)
It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.
You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.
@ymkjp
ymkjp / tenkaichi-git.md
Created November 22, 2012 14:59 — forked from teppeis/tenkaichi-git.md
天下一gitconfig大会

天下一gitconfig大会(サイボウズ社内git勉強会@2012/11/20)の@teppeisの資料です。

ぎっとぎとにしてやんよ

DojoCat

  • gistでmarkdown書いたらbookmarkletでプレゼンになるよ。