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
/** | |
* Note that the following media queries are intended to be used for the specified device or screen size | |
* in both portrait and landscape mode. | |
* | |
* Desktop queries are not provided since the default styles for most sites and applications typically focus | |
* on that for the default sites. | |
* | |
* Contributes, comments, and all that fun stuff always welcome :). | |
*/ | |
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
/* | |
Create Data URI's | |
Data URI’s can be useful for embedding images into HTML/CSS/JS to save on HTTP requests. | |
The following function will create a Data URI based on $file for easier embedding. | |
*/ | |
function data_uri($file, $mime) { | |
$contents=file_get_contents($file); | |
$base64=base64_encode($contents); | |
echo "data:$mime;base64,$base64"; |
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
.module { | |
/* 一些其它样式 | |
width: 300px; | |
height: 200px;*/ | |
/* 设置成 scroll,而不要用 auto */ | |
overflow-y: scroll; | |
-webkit-overflow-scrolling: touch; | |
} |
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
/* | |
* 避免子对象覆盖body的设置,因此选择器提高了属性等级另外加了important | |
*/ | |
.disable-hover, | |
.disable-hover * { | |
pointer-events: none !important; | |
} |
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
// 在用户将跳出当前页面时弹出确认框,确认框的文字会是"Please don't leave" | |
window.onbeforeunload = function(e) { | |
return "Please don't leave"; | |
}; |
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
<!-- | |
Using the datalist element, | |
HTML5 allows you to create a list of data to autocomplete a input field. | |
Super useful! | |
Here is a sample code to re-use in your own projects. | |
Source: http://davidwalsh.name/datalist | |
--> | |
<input name="frameworks" list="frameworks" /> |
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
setTimeout(function(){ | |
//processing | |
setTimeout(arguments.callee, interval); | |
}, interval); |
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
/** | |
* @media媒体侦测 | |
* | |
* 在针对不同平台或者屏幕尺寸时启用不同的css样式做到响应式布局 | |
* 下例先设置了一套主要的css样式,随后在宽度小于900px的设备上覆盖了另一套样式 | |
**/ | |
/* Style the main content and the sidebar */ | |
.container{ |
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
// 清理LaunchPad,并重启Dock | |
sudo rm ~/Library/Application\ Support/Dock/*.db | |
sudo killall Dock |
NewerOlder