Skip to content

Instantly share code, notes, and snippets.

@RockyMyx
RockyMyx / X-UA-Compatible.html
Last active December 19, 2015 01:29
HTML: X-UA-Compatible.html
<!-- http://stackoverflow.com/questions/3656237/why-inputtype-text-is-not-working-in-ie -->
<!-- http://lightcss.com/add-x-ua-compatible-meta-to-your-website/ -->
<!-- 在IE8刚推出的时候,很多网页由于重构的问题,无法适应较高级的浏览器,所以使用X-UA-Compatible标签强制IE8采用低版本方式渲染。-->
<!--IE7-->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<!--IE8-->
<meta http-equiv="X-UA-Compatible" content="IE=100" >
@RockyMyx
RockyMyx / browser-compatibility-header.html
Last active December 18, 2015 04:39
HTML: browser-compatibility-header.html
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class=""> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>DEMO</title>
<style type="text/css">
/**
* From: http://www.paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
@RockyMyx
RockyMyx / flex-start.html
Last active December 18, 2015 04:39
HTML: flex-start.html
<!doctype html>
<html lang="en">
<head>
<title>Flexbox Layout Demo</title>
<meta charset="utf-8">
<meta name="description" content="" />
<style type="text/css">
/* from: http://www.adobe.com/devnet/html5/articles/working-with-flexbox-the-new-spec.html?utm_source=CSS-Weekly&utm_campaign=Issue-51&utm_medium=email*/
@RockyMyx
RockyMyx / load-async.js
Last active December 18, 2015 04:39
JavaScript: load-async.js
/**
* From: http://coolshell.cn/articles/9749.html
**/
function cachejs(script_filename){
var cache = document.createElement('object');
cache.data = script_filename;
cache.id = "coolshell_script_cache_id";
cache.width = 0;
cache.height = 0;
@RockyMyx
RockyMyx / link-tooltip.css
Created June 4, 2013 16:40
CSS: link-tooltip.css
@RockyMyx
RockyMyx / body-top-shadow.css
Created June 4, 2013 15:52
CSS: body-top-shadow.css
body:before
{
content: "";
position:fixed;
top:-10px;
left:0;
width: 100%;
height: 10px;
-webkit-box-shadow: 0px 0px 10px rgba(0,0,0,.8);
-moz-box-shadow: 0px 0px 10px rgba(0,0,0,.8);
@RockyMyx
RockyMyx / using-unitless.css
Last active December 18, 2015 01:49
CSS: using-unitless.css
/**
* From:http://webdesign.tutsplus.com/articles/typography-articles/taking-ems-even-further/
**/
<style type="text/css">
article
{
/*The paragraph’s line-height is now relative to its own font-size*/
line-height: 1.5;
/*使用1.5em,由于继承性,line-height的值始终保持为1.5 * 16 = 24,而实际上想要的是1.5 * 20 = 30*/
@RockyMyx
RockyMyx / github-ribbon.css
Last active December 18, 2015 01:49
CSS: github-ribbon.css
<style type="text/css">
.ribbon
{
position: absolute;
left: -3em;
top: 3em;
background-color:Red;
-moz-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
@RockyMyx
RockyMyx / print.css
Created June 4, 2013 00:49
CSS: print.css
/**
* From: http://www.netmagazine.com/tutorials/make-your-website-printable-css
* <link rel="stylesheet" type="text/css" href="print.css" media="print">
**/
body {
background: #fff;
color: #000;
font-size: 8pt;
line-height: 150%;
margin: 0px;
@RockyMyx
RockyMyx / inheritance.js
Created June 2, 2013 16:30
JavaScript: inheritance.js
/*
*From: http://ejohn.org/blog/simple-javascript-inheritance/
*
*Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
*/
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;