Skip to content

Instantly share code, notes, and snippets.

@RockyMyx
RockyMyx / CSS: css-calc.html
Last active December 26, 2016 02:58
CSS calc
<!DOCTYPE html>
<html lang="en">
<head>
<title>Picnic CSS Testing</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="css, library, picnic, picnicss, light">
<meta name="description" content="A lightweight CSS library">
<link rel="stylesheet" href="web/style/style.min.css">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
第一个meta标签表示:强制让文档的宽度与设备的宽度保持1:1,并且文档最大的宽度比例是1.0,且不允许用户点击屏幕放大浏览;
第二个meta标签是iphone设备中的safari私有meta标签,它表示:允许全屏模式浏览;
第三个meta标签也是iphone的私有标签,它指定的iphone中safari顶端的状态条的样式;
第四个meta标签表示:告诉设备忽略将页面中的数字识别为电话号码;
@RockyMyx
RockyMyx / AddThis.js
Last active December 23, 2015 19:19
JavaScript: AddThis.js
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-524142667f2b8f48"></script>
<script type="text/javascript">
//Go to http://www.addthis.com/get/smart-layers to customize -->
addthis.layers({
'theme': 'transparent',
'share': {
'position': 'left',
'numPreferredServices': 5
},
'whatsnext': {},
@RockyMyx
RockyMyx / parse-url.js
Created September 7, 2013 15:13
JavaScript: parse-url.js
//http://tutorialzine.com/2013/07/quick-tip-parse-urls/
$(function(){
// The URL we want to parse
var url = 'http://tutorialzine.com/2013/07/quick-tip-parse-urls/?key=value#comments';
// The magic: create a new anchor element, and set the URL as its href attribute.
// Notice that I am accessing the DOM element inside the jQuery object with [0]:
var a = $('<a>', { href:url } )[0];
@RockyMyx
RockyMyx / reponsive-web.config
Created August 18, 2013 15:35
.NET: reponsive-web.config
<redirect firstRequestOnly="true"
mobileHomePageUrl="~/Mobile/Default.aspx"
timeout="20"
devicesFile="~/App_Data/Devices.dat"
mobilePagesRegex="/(Mobile|Smartphone)/" >
<locations>
<!--Send smartphones to an equivalent version of the original page, preserving the page name and query string.-->
<location name="smartphone" url="~/Smartphone/{0}" matchExpression="(?<=^\w+://.+/).+">
<add property="IsSmartphone" matchExpression="true"/>
</location>
// the semi-colon before function invocation is a safety net against concatenated
// scripts and/or other plugins which may not be closed properly.
;(function ( $, window, document, undefined ) {
// undefined is used here as the undefined global variable in ECMAScript 3 is
// mutable (ie. it can be changed by someone else). undefined isn't really being
// passed in so we can ensure the value of it is truly undefined. In ES5, undefined
// can no longer be modified.
// window is passed through as local variable rather than global
@RockyMyx
RockyMyx / CSS : mobile-font-setup.css
Created August 2, 2013 09:04
CSS : mobile-font-setup.css
/* https://github.com/AlloyTeam/Mars/blob/master/font-family.md */
body {
font-family: HelveticaNeue, Helvetica, STHeiTi, sans-serif;
}
/*iOS 4.0+ 使用英文字体 Helvetica Neue,之前的iOS版本降级使用 Helvetica。
中文字体设置为华文黑体STHeiTi。
@RockyMyx
RockyMyx / rAF.js
Created July 20, 2013 12:05 — forked from paulirish/rAF.js
JavaScript: rAf.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@RockyMyx
RockyMyx / easy-grid-to-excel.cs
Created July 15, 2013 10:57
C#: easy-grid-to-excel
protected void OnExportClick(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gridView.RenderControl(htw);
//解决数字导出时可能会出现截断的情况,如001变成1,需配合RowDataBound事件使用
@RockyMyx
RockyMyx / table-with-slash-header.html
Last active December 19, 2015 18:28
HTML: table-with-slash-header.html
<!--http://www.blueidea.com/tech/web/2009/6381.asp-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用div+css模拟表格对角线</title>
<style type="text/css">
table{ border-collapse:collapse;border:1px #525152 solid;width:90%;margin:0 auto;margin-top:100px;}
th,td{border:1px solid #525152;text-align:center;font-size:12px;line-height:30px;background:#C6C7C6;}