Skip to content

Instantly share code, notes, and snippets.

@ukyo
ukyo / melFilterBand.js
Created May 26, 2012 21:53
create mel filter band
// http://d.hatena.ne.jp/aidiary/20120225/1330179868
// port python to JavaScript.
function melFilterBand(sampleRate, nfft, numChannels) {
var fmax = sampleRate >>> 1,
melmax = hz2mel(fmax),
nmax = nfft / 2,
df = sampleRate / nfft,
dmel = melmax / (numChannels + 1),
melcenters = [],
@ukyo
ukyo / markdown.html5.js
Created June 6, 2012 00:33
markdown.html5.js
// Released under MIT license
// Copyright (c) 2012 Syu Kato <ukyo.web@gmail.com>
markdown.toHTML5 = function(source, dialect, options) {
return markdown.renderJsonML((function to5(tree, level) {
var i, m,
indices = [],
hx = 'h' + level,
n = tree.length,
blocks = [];
@ukyo
ukyo / markdown.gfm.js
Created June 16, 2012 12:33
markdown GFM
(function(Markdown) {
Markdown.dialects.GFM = Markdown.subclassDialect(Markdown.dialects.Gruber);
Markdown.dialects.GFM.block.code_syntax_highlighting = function(block, next) {
var ret = [],
startRe = /^```(.*)\n?((.|\n)*)/,
endRe = /(.|\n)*```\n?$/,
m = block.match(startRe),
lang, code, lineRe, isEnd;
@ukyo
ukyo / prototype.md
Last active October 6, 2015 11:57
About Javascript prototype

#プロトタイプと、あとクラス、継承、ミックスインと呼ばれている物の説明

この文書はなるべく正確な情報を書きたいのでちょくちょく更新されます。あと、ちょくちょくキャラが変わるのは気にしないでください。修正した部分に関する情報は コメント やリビジョンを参照してください。

プリミティブ型とオブジェクト型

Javascriptの変数にはプリミティブ型とオブジェクト型が存在する。

###プリミティブ型

@ukyo
ukyo / Generic reStructuredText.rst
Created June 27, 2012 00:30
reStructuredText Sample

Example Chapter Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ligula sapien, malesuada eu tempor eu, sagittis nec nibh. Fusce sit amet nunc sit amet felis semper molestie. Proin orci dolor, interdum ut lacinia id, semper quis nisi. Aenean vestibulum ullamcorper eros et vulputate. Fusce diam turpis, facilisis nec consectetur vitae, dapibus vel sapien.

@ukyo
ukyo / gist-toc.js
Created June 27, 2012 01:31
toc tree for gist
(function(l, l2, s) {
l2 = l2 || 6;
NodeList.prototype.forEach = [].forEach;
NodeList.prototype.slice = [].slice;
var toc = document.createElement('div');
var headerLevel = l || 2;
var tocStyle = s || 'ul';
@ukyo
ukyo / gist-toc-usage.md
Created June 27, 2012 02:20
gist-toc.js usage
@ukyo
ukyo / hshs.js
Created June 30, 2012 18:13
hshs.js is a simple oop library
/*
USAGE
web:
<script>var __scope__ = yournamespace;</script>
<script src="hshs.js"></script>
node:
var hshs = require('path/to/hshs.js');
@ukyo
ukyo / memo.js
Created August 23, 2012 10:32
memo
var POWERMATE_VENDOR_ID = 0x058f;
var POWERMATE_PRODUCT_ID = 0x3831;
@ukyo
ukyo / github_oauth2_flow.md
Created August 30, 2012 03:27
github oauth2 flow

#get client id

go to here and create app.

#authorize

//set a uuid.
localStorage.state = createUUID();