Skip to content

Instantly share code, notes, and snippets.

View zhuzhuaicoding's full-sized avatar

zhuzhu_coder zhuzhuaicoding

View GitHub Profile
@zhuzhuaicoding
zhuzhuaicoding / gist:4110011
Created November 19, 2012 10:29
arguments convert to array
var args = Array.apply([], arguments )
@zhuzhuaicoding
zhuzhuaicoding / gist:4492717
Created January 9, 2013 12:20
fixes NaN returning as Number
// fixes NaN returning as Number
Number.prototype.$family = function(){
return isFinite(this) ? 'number' : 'null';
}
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>Test fullscreen</title>
<style>
html, body {
margin: 0;
padding: 0;
function getGroupCallBackGenerator(timeOut,finalCallback){
var waitingStatus={};
var resultObject={};
var started=false;
var timedOut=false;
var timer=setTimeout(function(){
timedOut=true;
if(typeof(finalCallback)=="function"){
finalCallback(resultObject);
}
(function(window,undefined){
// Prepare our Variables
var
document = window.document,
$ = window.jQuery;
// Wait for Document
$(window).bind(function(){
// Prepare Variables
function camelCase(name) {
return name.
replace(/([\:\-\_]+(.))/g, function(_, separator, letter, offset) {
return offset ? letter.toUpperCase() : letter;
}).
replace(/^moz([A-Z])/, 'Moz$1');
}
@zhuzhuaicoding
zhuzhuaicoding / gist:5894505
Created June 30, 2013 09:31
水平垂直居中
.center {display:-webkit-box; -webkit-box-orient:horizontal; -webkit-box-align:center; text-align:center;}
@zhuzhuaicoding
zhuzhuaicoding / gist:6059662
Created July 23, 2013 03:32
Chunked transfer encoding
HTTP servers sometimes use compression (gzip) or deflate methods to optimize transmission. How both chunked and gzip encoding interact is dictated by the two-staged encoding of HTTP: first the content stream is encoded as (Content-Encoding: gzip), after which the resulting byte stream is encoded for transfer using another encoder (Transfer-Encoding: chunked). This means that in case both compression and chunked encoding are enabled, the chunk encoding itself is not compressed, and the data in each chunk should not be compressed individually. The remote endpoint can decode the incoming stream by first decoding it with the Transfer-Encoding, followed by the specified Content-Encoding.
@zhuzhuaicoding
zhuzhuaicoding / gist:6059770
Created July 23, 2013 04:03
IE6下script标签开启gzip后的解决办法
IE6下script标签开启gzip后的解决办法
1.官方论坛回答:http://support.microsoft.com/kb/327286/en-us?sid=64&spid=2073
To work around this problem, you can do either of the following:
If you use a Cache-Control: no-cache HTTP header to prevent the files from caching, remove that header. In some situations, if you substitute an Expires HTTP header, you do not trigger the problem.
-or-
Do not enable HTTP compression for the script files.
@zhuzhuaicoding
zhuzhuaicoding / gist:6059778
Created July 23, 2013 04:04
pad6重播画面来回放 bug
pad6重播画面来回放 bug
pad 6 上 重播视频时 播放结束后点击重播,会出现来回很快放的bug,可以通过调load,然后调play方法解决,目前已在html5Player 的replay方法实现!!