This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// consider the following code | |
function getInfoDef() { | |
var result = {something: 'static'}; | |
var def = $.Deferred(); | |
$.ajax('/some-url').then(function(data) { | |
result.also = data.dynamic; | |
def.resolve(result); | |
}).fail(def.reject.bind(def)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return Collatz sequence in an array. | |
// Linear Vs Tail Recursion in Javascript | |
// http://jsperf.com/collatz-conjecture-linear-vs-tail | |
//=================================================================================================================== | |
function collatzTail(n, accumulator){ | |
if(n === 1) { | |
accumulator.push(1); | |
return accumulator; | |
} else if(isEven(n)) { | |
accumulator.push(n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require) { | |
var system = require('../system'); | |
var animationTypes = [ | |
'bounce', | |
'bounceIn', | |
'bounceInDown', | |
'bounceInLeft', | |
'bounceInRight', | |
'bounceInUp', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Japanese text normalization (fullwidth to halfwidth) | |
function normalize(s) { | |
function zentohan(c) { | |
var z2h = { | |
'ガ':'ガ','ギ':'ギ','グ':'グ','ゲ':'ゲ','ゴ':'ゴ', | |
'ザ':'ザ','ジ':'ジ','ズ':'ズ','ゼ':'ゼ','ゾ':'ゾ', | |
'ダ':'ダ','ヂ':'ヂ','ヅ':'ヅ','デ':'デ','ド':'ド', | |
'バ':'バ','パ':'パ','ビ':'ビ','ピ':'ピ','ブ':'ブ', | |
'プ':'プ','ベ':'ベ','ペ':'ペ','ボ':'ボ','ポ':'ポ','ヴ':'ヴ', | |
'ァ':'ァ','ア':'ア','ィ':'ィ','イ':'イ','ゥ':'ゥ','ウ':'ウ','ェ':'ェ','エ':'エ','ォ':'ォ','オ':'オ', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Input test</title> | |
</head> | |
<body> | |
<form method="post" action="#"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REFERENCE UNICODE TABLES: | |
// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml | |
// http://www.tamasoft.co.jp/en/general-info/unicode.html | |
// | |
// TEST EDITOR: | |
// http://www.gethifi.com/tools/regex | |
// | |
// UNICODE RANGE : DESCRIPTION | |
// | |
// 3000-303F : punctuation |