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
var imageList=(function(){ | |
var _list=[],_head; | |
$('#imageList li').each(function(){ | |
_list.push($(this)); | |
}); | |
_head=_list[0]; | |
return { |
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
(function(str){ | |
var maxPalin=''; | |
for(var i=0,len=str.length;i<len;++i){ | |
var letter=str[i],substr; | |
for(var j=i;j<len;++j){ | |
if(letter == str[j]){ | |
maxPalin=(function(substr){ | |
return (function(substr){ |
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
/** | |
* Get random charactor from a given charset | |
*/ | |
var getRandomChar = (function(str) { | |
var len = str.length; | |
return function() { | |
return str.charAt(Math.floor(Math.random() * len)); | |
}; |
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
function new_array(/* length */ len, /* default */ value) { | |
var len = ~~len; | |
return value | |
? new Array ( len + 1 ).join( value ).split( '' ) | |
: new Array ( len ); | |
} |
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> | |
<head> | |
<meta charset="utf-8" /> | |
<title> An interesting question</title> | |
<style> | |
table { | |
border-collapse:collapse; | |
border-spacing:0; | |
margin: 100px auto 0; |
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> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Test -- self-closed iframe problem</title> | |
<script> | |
/* quick and dirty */ | |
function log(info) { | |
return window.console | |
? console.log.apply(console,arguments) |
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
//Printing 1 to 1000 without loop or conditionals | |
//http://stackoverflow.com/questions/4568645/printing-1-to-1000-without-loop-or-conditionals/4583502#4583502 | |
// using replace | |
(function(max){ | |
new Array(max + 1).join(' ').replace(/\s/g, function(c, i){ | |
console.log(i + 1); | |
}) | |
})(1000) |
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
function range(start, stop, step) { | |
var range = []; | |
stop || (stop = start || 0, start = 0); | |
step || (step = 1); | |
while ((step > 0 && start < stop) || (step < 0 && start > stop)) { | |
range.push(start); | |
start += step; | |
} | |
return range; | |
}; |
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> | |
<head> | |
<meta charset="utf-8" /> | |
<title>jQuery live('submit') and disabled submit button </title> | |
<style> | |
form {margin-bottom:50px;} | |
</style> | |
</head> | |
OlderNewer