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
// Node.js CheatSheet. | |
// Download the Node.js source code or a pre-built installer for your platform, and start developing today. | |
// Download: http://nodejs.org/download/ | |
// More: http://nodejs.org/api/all.html | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.html |
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
/* on an iOS device, when you click the link having :hover css and navigate away to the next page and then hit the browsers’ back button, when you come back on this screen, you will see the above link is still in hover state */ | |
// use Modernizr, the no-touch class will be added to the root html element for non-touch devices. Then you can do this | |
a.myclass { | |
color:#999; | |
} | |
.no-touch a.myclass:hover, | |
a.myclass:active { |
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
/* | |
The function* declaration (function keyword followed by an asterisk) defines a generator function, which returns a Generator object. | |
You can also define generator functions using the GeneratorFunction constructor and a function* expression. | |
*/ | |
// Syntax | |
function* name([param[, param[, ... param]]]) { | |
statements | |
} |
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
/* TOP TO BOTTOM */ | |
.sliding-u-t-b { | |
text-decoration: none; | |
display: inline-block; | |
border-bottom: 0px solid transparent; | |
width: 210px; | |
transition: 0.5s ease; | |
height: 25px; | |
} |
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
function MouseWheelHandler(e) { | |
var e = window.event || e; // old IE support | |
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); | |
if (delta < 0) // scroll down | |
// scroll downaction here | |
else // scroll up | |
// scroll up action here | |
} | |
if (window.addEventListener) { |
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
// Provide a surrogate or placeholder for another object to control access to it. | |
// 常用的虚拟代理形式:某一个花销很大的操作,可以通过虚拟代理的方式延迟到这种需要它的时候才去创建 | |
//(例:使用虚拟代理实现图片懒加载) | |
// 图片懒加载的方式:先通过一张loading图占位,然后通过异步的方式加载图片,等图片加载好了再把完成的图片加载到img标签里面。 | |
var imgFunc = (function() { | |
var imgNode = document.createElement('img'); | |
document.body.appendChild(imgNode); | |
return { | |
setSrc: function(src) { |
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
Edit script var/packages/transmission/scripts/start-stop-status | |
in start_daemon () block | |
changed from : | |
su - ${USER} "PATH=${PATH} ${TRANSMISSION} -g ${INSTALL_DIR}/var/ -x ${PID_FILE}" | |
to | |
sudo -u ${USER} /bin/sh -c "PATH=${PATH} ${TRANSMISSION} -g ${INSTALL_DIR}/var/ -x ${PID_FILE}" |
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
In the search box on the taskbar, type cmd. | |
2.Right-click Command Prompt in the search results and select Run as administrator. (Select Yes, when prompted by the User Account Control.) | |
3.In the Administrator: Command Prompt window, type the following command and press Enter: | |
SC config wuauserv start= auto [Press Enter] | |
SC config bits start= auto [Press Enter] | |
SC config cryptsvc start= auto [Press Enter] |