Skip to content

Instantly share code, notes, and snippets.

@think49
think49 / getAncestorElementByTagName.js
Created December 29, 2010 20:06
getAncestorElementByTagName.js : 対象の tagName を持つ祖先要素ノードを返す。存在しなければ null を返す。
/**
* getAncestorElementByTagName.js
*
* @version 1.0
* @author think49
*/
/**
* get Ancestor Element by tagName.
@think49
think49 / rfc3986.js
Created January 7, 2011 20:59
rfc3986.js : RFC3986 に準拠した URI チェッカー
/**
* rfc3986.js
* Uniform Resource Identifier (URI): Generic Syntax (RFC3986)
*
* @version 1.0
* @author think49
* @url https://gist.github.com/770087
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">www.ietf.org/rfc/rfc3986.txt</a>
* @see <a href="http://www.studyinghttp.net/rfc_ja/rfc3986">Uniform Resource Identifier (URI): &#x4e00;&#x822c;&#x7684;&#x69cb;&#x6587;</a>
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
@think49
think49 / LingrRoomArchives-bookmarklet.html
Created January 15, 2011 17:39
LingrRoomArchives-bookmarklet.js : Lingr の "room archives" でHTMLログを出力する bookmarklet
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Lingr room bookmarklet</title>
<style>
html { margin: 0; padding: 0; }
body { margin: 0; padding: 0; color: #555; background-color: #fdfdd1; }
h1, h2, h3, h4, h5, h6 { margin: 0; padding: 0; color: #CB7500; font-family: Georgia, Times, serif; text-shadow: #DDD 0px 0.05em 0.05em; }
@think49
think49 / Twitter-outputHTML-bookmarklet.js
Created January 16, 2011 03:22
Twitter-outputHTML-bookmarklet.js
/**
* Twitter-outputHTML-bookmarklet.js
*
* @version 1.2
* @author think49
*/
if (!('outerHTML' in document.createElement('p')) && 'innerHTML' in document.createElement('p') && (typeof HTMLElement === 'function' || typeof HTMLElement === 'object')) {
(function () {
var _Node = (typeof Node === 'function' || typeof Node === 'object') ? Node : {
@think49
think49 / outerHTML.js
Created January 16, 2011 08:27
outerHTML.js : HTML5 規定の element.outerHTML を定義する。
/**
* outerHTML.js
*
* @version 1.4
* @author think49
*/
if (!('outerHTML' in document.createElement('p')) && 'innerHTML' in document.createElement('p') && (typeof HTMLElement === 'function' || typeof HTMLElement === 'object')) {
(function () {
var _Node = (typeof Node === 'function' || typeof Node === 'object') ? Node : {
@think49
think49 / Array.prototype.shuffle.txt
Created January 28, 2011 14:24
array-shuffle.js : "Fisher–Yates shuffle"
----------------------
Fisher–Yates shuffle
----------------------
* Fisher and Yates' original method
1. Write down the numbers from 1 to N.
2. Pick a random number k between one and the number of unstruck numbers remaining (inclusive).
3. Counting from the low end, strike out the kth number not yet struck out, and write it down elsewhere.
4. Repeat from step 2 until all the numbers have been struck out.
@think49
think49 / percentEncode.js
Created February 1, 2011 04:50
percentEncode.js : RFC3986 規定のパーセントエンコーディング
/**
* percentEncode.js
*
* @version 0.9.2
* @author think49
* @url https://gist.github.com/805428
*/
var percentEncode = (function () {
@think49
think49 / print.css
Last active March 1, 2016 01:58
print.js : 指定した要素ノードにテキストを挿入する
@charset "UTF-8";
/**
* print.css
*
* @version 1.0.1
* @author think49
*/
#print { margin: 1em 0; padding: 0.5em; border: 1px solid #999; color: black; background-color: #EFEFEF; font-family: monospace; }
@think49
think49 / abnf.js
Created February 15, 2011 13:52
abnf.js : RFC5234 規定の ABNF 文字列を ECMAScript5 の RegExp 準拠の文字列に変換する
/**
* abnf.js
*
* [RFC 5234] Augmented BNF for Syntax Specifications: ABNF
* http://www.ietf.org/rfc/rfc5234.txt
* http://www.cam.hi-ho.ne.jp/mendoxi/rfc/rfc5234j.html
*
* @version 0.1
* @author think49
*/
@think49
think49 / NumberString.js
Created March 6, 2011 05:06
NumberString.js : 2-36の基数を持つ数値文字列オブジェクトを生成するコンストラクタ
/**
* NumberString.js
*
* @version 2.0.1
* @author think49
* @url https://gist.github.com/857047
*/
var NumberString;