This file contains 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
.hint {position:absolute;font:12px arial, 宋体;background:#2d2d2d;color:#f2f2f2;padding:6px 9px;border:1px solid #000;z-index: 999;margin-top:0.5em;} | |
.hint-content {position: relative;z-index: 1000;} | |
.hint i, .hint em {position: absolute;display: block;height: 0;width: 0;background: transparent;border: 6px solid transparent;z-index: 100;border-bottom-color: #000;top: -1em;left: 50%;margin-left: -0.5em;} | |
.hint i {border-bottom-color: #2d2d2d;z-index: 101;margin-top: 1px;} |
This file contains 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
function toChineseNumeral(num){ | |
var numerals = { | |
'-':'负', | |
'.':'点', | |
0:'零', | |
1:'一', | |
2:'二', | |
3:'三', | |
4:'四', | |
5:'五', |
This file contains 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
function Befunge(code) { | |
var output = ''; | |
var stack = []; | |
var codeArray = code.split('\n'); | |
var x = 0; | |
var y = 0; | |
var d = code.charAt(0); | |
var next = d; | |
var cmd = 'NORMAL'; | |
var loop = true; |
This file contains 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
function Maybe() { | |
Object.freeze(this); | |
} | |
function Just (x) { | |
this.toString = function () { return "Just " + x.toString(); }; | |
this.just = x; | |
Object.freeze(this); | |
} | |
Just.prototype = new Maybe(); |
This file contains 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
function UriBuilder(uri) { | |
this.uri = uri; | |
this.parse(); | |
return this; | |
} | |
UriBuilder.prototype.parse = function() { | |
// var match = this.uri.match(/(\w+:\/\/?.+?\..+\..+)?(\?.+)/); | |
var match = this.uri.split('?'); | |
var params, o = {},t; |
This file contains 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
var GeneticAlgorithm = function () {}; | |
GeneticAlgorithm.prototype.generate = function(length) { | |
var s = ''; | |
while (length--) { | |
s += ~~(Math.random()+0.5); | |
} | |
return s; | |
}; |
This file contains 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
function List() {} | |
function EmptyList() {} | |
EmptyList.prototype = new List(); | |
EmptyList.prototype.constructor = EmptyList; | |
EmptyList.prototype.toString = function() { return '()'; }; | |
EmptyList.prototype.isEmpty = function() { return true; }; | |
EmptyList.prototype.length = function() { return 0; }; | |
EmptyList.prototype.push = function(x) { return new ListNode(x, this); }; |
This file contains 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"> | |
<title>Document</title> | |
<style> | |
body {padding:0 20px;margin: 0;font-family: '黑体', sans-serif;} | |
code {border: 1px solid #e3e3e3;padding: 1px 2px;} | |
#res {height: 5em;border: 1px solid #999;} | |
</style> |
OlderNewer