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 / generate_pdf.pl
Created October 24, 2012 12:54 — forked from stanaka/generate_pdf.pl
Generate pdf for analyzing kindle paperwhite resolution
#!/usr/bin/env perl
use strict;
use warnings;
use GD;
sub draw_page {
my ($width, $height) = @_;
return unless $width && $height;
@ymkjp
ymkjp / createDocumentFragment.js
Created November 20, 2012 03:51
Performance of DOM
var fragment = document.createDocumentFragment();
for (var i = 0; i < 10; i++) {
var child = document.createElement('div');
// here
fragment.appendChild(child);
}
document.getElementById('parent').appendChild(fragment);
@ymkjp
ymkjp / addToNode.js
Created November 20, 2012 03:52
About node
var elem = document.createElement('div'),
text = document.createTextNode('Added div element.');
document.body.appendChild(elem);
elem.appendChild(text);
var comment - document.createComment('This is comment.');
document.body.insertBefore(comment, elem);
@ymkjp
ymkjp / arraySlice.js
Created November 20, 2012 06:26
Array.prototype.slice()
//Array.prototype.slice()
var nodeList = decument.getElementsByTagname('span');
alert(nodeList instanceof NodeList); // => true
alert(nodeList instanceof Array); // => false
var array = Array.prototype.slice.call(nodeList);
alert(array instanceof NodeList); // => false
alert(array instanceof Array); // => true
@ymkjp
ymkjp / PerformanceRace_NodeList-vs-Array.html
Created November 20, 2012 07:32
Performance: NodeList vs. Array
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Performance race</title>
</head>
<body>
<h1>Performance race: NodeList vs. Array</h1>
<p>Check the console.</p>
<div>
@ymkjp
ymkjp / XPath_sample.html
Created November 20, 2012 12:24
妻がどうぶつの森に行ったまま期待通りの値を返してこなくなりました
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Performance: NodeList vs. Array</title>
<script type="text/javascript">
var result = document.evaluate(
// 1. <div> id == main
// 2. 3rd <p> class == content
// 3. <a> starts with href http://example.com/
@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でプレゼンになるよ。
@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 / 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 / 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% - はてなブックマーク">