Skip to content

Instantly share code, notes, and snippets.

View zhuzhuaicoding's full-sized avatar

zhuzhu_coder zhuzhuaicoding

View GitHub Profile
@subtleGradient
subtleGradient / position-fixed.css
Created July 29, 2009 16:17
Make position:fixed work in IE6
/*Make position:fixed work in IE6!*/
.fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0;}
.fixed-bottom /* position fixed Bottom */{position:fixed;bottom:0;top:auto;}
.fixed-left /* position fixed Left */{position:fixed;right:auto;left:0;}
.fixed-right /* position fixed right */{position:fixed;right:0;left:auto;}
* html,* html body /* IE6 Fixed Position Jitter Fix */{background-image:url(about:blank);background-attachment:fixed;}
* html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
* html .fixed-right /* IE6 position fixed right */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}
@ricardobeat
ricardobeat / semaphore.js
Created March 3, 2011 01:30
simple semaphore for parallel async execution, with error handling.
function queue(name){
queue.q[name]++ || (queue.q[name] = 1);
return function(err){
if (err && queue.e[name]) queue.e[name](err);
else if (err) throw err;
process.nextTick(function(){
queue.q[name]--;
queue.check(name);
});
}
@millermedeiros
millermedeiros / gist:891886
Created March 29, 2011 06:21
iPad HTML5 video quirks and hacks
/*
* Example how to preload HTML5 video on the iPad (iOS 3.2+)
* @author Miller Medeiros
* Released under WTFPL
*/
var vid = document.createElement('video');
vid.src = 'lol_catz.mp4';
document.getElementById('video-holder').appendChild(vid);
@rcampbell
rcampbell / lexer.js
Created May 5, 2011 10:12
Lexical Analyzer for Scheme R5RS in JavaScript
//
// Lexical Analyzer for Scheme R5RS
//
// TODO: numbers, better error reporting
//
// Depends on Functional Javascript: http://osteele.com/sources/javascript/functional/
//
Functional.install();
@nateps
nateps / gist:1172490
Created August 26, 2011 01:38
Hide the address bar in a fullscreen iPhone or Android web app
<!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;
@nfreear
nfreear / onlineaspect-josh-fraser-postmessage.js
Created March 19, 2012 11:40
Backwards compatible window.postMessage(), by Josh Fraser, 15 January 2010 | http://onlineaspect.com/uploads/postmessage/postmessage.js
/*
* a backwards compatable implementation of postMessage
* by Josh Fraser (joshfraser.com)
* released under the Apache 2.0 license.
*
* this code was adapted from Ben Alman's jQuery postMessage code found at:
* http://benalman.com/projects/jquery-postmessage-plugin/
*
* other inspiration was taken from Luke Shepard's code for Facebook Connect:
* http://github.com/facebook/connect-js/blob/master/src/core/xd.js
var bingCW_ht_pop_el = document.getElementById("bingCW_ht_pop");
if (bingCW_ht_pop_el == null)
BingCW = new function() {
this.Config = {Disabled: false,DisableHover: false,DisableSelection: false,DisablePharse: false,WebDefinition: true,MachineTranslation: true,ICON: "ZH"};
var I = "D1CB4BBF472140DE99370A52F1F8F554", o = [document.body], F = {}, n = null, a = null, m = [], l = [], v = null, q = [], h = null, E = false, p = "dict.bing.com.cn", ab = "#bingCW_ht_pop,#bingCW_ht_box,#bingCW_ht_content,#bingCW_ht_QWA,#bingCW_ht_footer,.bingCW_ht_QueryWord,.bingCW_ht_attr,.bingCW_ht_pos,.bingCW_ht_list,.bingCW_ht_list2,.bingCW_ht_listItem,.bingCW_ht_listItem2,.bingCW_ht_link,#bingCW_ht_badge{margin:0px;padding:0px;width:auto;height:auto;white-space:normal;border:0px solid #ace;background-color:White;background-image:none;text-indent:0px;line-height:17px;font-family:arial, helvetica, sans-serif;font-size:13px;color:Black;float:none;visibility:visible;text-align:left;vertical-align:baseline;display
@michaelcox
michaelcox / xdr.js
Created May 10, 2012 18:56
Adds XDomainRequest IE CORS support to jQuery
// Based on https://github.com/jaubourg/ajaxHooks/blob/master/src/ajax/xdr.js
(function( jQuery ) {
if ( window.XDomainRequest && !jQuery.support.cors ) {
jQuery.ajaxTransport(function( s ) {
if ( s.crossDomain && s.async ) {
if ( s.timeout ) {
s.xdrTimeout = s.timeout;
delete s.timeout;
@FGRibreau
FGRibreau / hash_range.js
Created September 21, 2012 09:28
My yesterday night 1 hour code rush: JavaScript Hash with Range-based keys
/**
* September 20 night: 1 hour code rush
* @FGRibreau
*
* Requirements
* ------------
* The aim of this code rush is to enable developers to define a "range hash map"
* in a very expressive way (without if/then/else).
*
* Data-set
@burin
burin / gist:3840737
Created October 5, 2012 16:06
Full screen web app in iPhone 5 (save to home screen)
<!-- standard viewport tag to set the viewport to the device's width
, Android 2.3 devices need this so 100% width works properly and
doesn't allow children to blow up the viewport width-->
<meta name="viewport" id="vp" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" />
<!-- width=device-width causes the iPhone 5 to letterbox the app, so
we want to exclude it for iPhone 5 to allow full screen apps -->
<meta name="viewport" id="vp" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)" />
<!-- provide the splash screens for iPhone 5 and previous -->
<link href="assets/splashs/splash_1096.png" rel="apple-touch-startup-image" media="(device-height: 568px)">
<link href="assets/splashs/splash_iphone_2x.png" rel="apple-touch-startup-image" sizes="640x960" media="(device-height: 480px)">