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
@echo off | |
for /l %%i in (1,1,115) do ( | |
@echo %%i... | |
copy sourceFile Path/%%i_DesinationFile | |
) | |
pause |
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
/* | |
* 频率控制 返回函数连续调用时,fn 执行频率限定为每多少时间执行一次 | |
* @param fn {function} 需要调用的函数 | |
* @param delay {number} 延迟时间,单位毫秒 | |
* @param immediate {bool} 给 immediate参数传递false 绑定的函数先执行,而不是delay后后执行。 | |
* @return {function} 实际调用函数 | |
*/ | |
var throttle = function (fn,delay, immediate, debounce) { | |
var curr = +new Date(),//当前时间 | |
last_call = 0, |
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
// Simple JavaScript Templating | |
// John Resig - http://ejohn.org/ - MIT Licensed | |
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || |
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
/* | |
10 x 10 | |
A-Z ( 65 -> 90) | |
output something like this | |
* * * * * * * * * * | |
* * * * * * * * * * | |
* * * * * * * * * * | |
* J I * * * * * * * |
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 supports = (function() { | |
var div = document.createElement('div'), | |
vendors = 'Khtml Ms O Moz Webkit'.split(' '), | |
len = vendors.length; | |
return function(prop) { | |
if ( prop in div.style ) return true; | |
prop = prop.replace(/^[a-z]/, function(val) { | |
return val.toUpperCase(); |
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
# http://stackoverflow.com/questions/6393787/php-url-to-link-with-regex | |
$str = preg_replace('#(\A|[^=\]\'"a-zA-Z0-9])(http[s]?://(.+?)/[^()<>\s]+)#i', '\\1<a href="\\2">\\3</a>', $str); |
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 bindMouseLeave(obj, fn) { | |
if (obj.attachEvent) { | |
obj.attachEvent('onmouseleave', function() { | |
fn.call(obj, window.event); | |
}); | |
} else { | |
obj.addEventListener('mouseout', function(e) { | |
var rt = e.relatedTarget; | |
if (rt !== obj && !isContain(obj, rt)) { | |
fn.call(obj, e); |
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
<?php | |
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
function human_filesize($bytes, $decimals = 2) { | |
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
} | |
echo human_filesize(filesize('example.zip')); |
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
{ | |
'Safari Developer Library': 'https://developer.apple.com/library/safari/navigation/index.html', | |
'Safari HTML Reference': 'https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html', | |
'Safari Web Content Guide': 'https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/Introduction/Introduction.html' | |
} |
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
/** | |
* find all markdown files in given directory, (here just current directory) | |
* and then fetch their title to generate index markdown file | |
* | |
* use -v to show verbose detail | |
* use -o to specify output file, default to ./index.md | |
* use -d to specify scanner directory, such as -d the_directory, default to ./ | |
*/ | |
var fs = require('fs'), | |
path = require('path') |