Skip to content

Instantly share code, notes, and snippets.

View gucheen's full-sized avatar

Cheng Gu gucheen

View GitHub Profile
@gucheen
gucheen / gist:5471735
Created April 27, 2013 03:07
Js获取天气信息
//看到WScript字样你应该就知道这是一个运行在宿主上面的脚本了
//因为运用到的正则处理比较多,所以我用jscript作为编写语言
(function(WS,City){
//由于获取的内容确定是utf-8编码,而jscript的字符串处理默认就是utf-8,因此不需要编码转换了
function getURL(url, method, callback) {
with(new ActiveXObject("msxml2.xmlhttp")) {
open(method, url + (url.match(/\?/) ? '&': '?') + Math.random(), 0);
setRequestHeader('User-Agent',
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
send();
#Top{background:#3FADB3;border:none;}
#Bottom{border-top: 3px solid #A3CEBE;}
a.top:link,a.top:visited,a.top:active,.topic_buttons div:first-child{text-shadow:none;color:#fff !important;}
.cell{background: #F8F8F8;}
.header{border-bottom: 3px solid #E5E8EE;}
.box{box-shadow:none;border:none;}
.topic_buttons{background:#ddd;}
a.tb:link, a.tb:visited, a.tb:active{color:#f5f5f5;text-shadow:none;}
#Search>form>div{background: none !important;}
#q{background: #FFF !important;
@gucheen
gucheen / QQ-menu
Created January 24, 2014 13:17
注销QQ右键发送文件菜单
regsvr32 /u "C:\Program Files (x86)\Tencent\QQ\Bin\QQShellExt64.dll"
@gucheen
gucheen / meta-viewport.html
Created January 25, 2014 14:59
meta-viewport
<meta name="viewport" content="width=device-width, user-scalable=no">
@media screen and (max-width: 600px){
nav{
display: none;
}
}
@gucheen
gucheen / gist:8879984
Created February 8, 2014 09:25
兼容性疑难解答注册表项
HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\Compatibility
HKEY_CLASSES_ROOT\exefile\shellex\ContextMenuHandlers\Compatibility
HKEY_CLASSES_ROOT\batfile\ShellEx\ContextMenuHandlers\Compatibility
@gucheen
gucheen / readablizeBytes.js
Created March 4, 2014 09:02
文件大小单位转换
function readablizeBytes(bytes) {
var s = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}
@gucheen
gucheen / docCookies.js
Created March 12, 2014 08:27
A little framework: a complete cookies reader/writer with full unicode support
/*\
|*|
|*| :: cookies.js ::
|*|
|*| A complete cookies reader/writer framework with full unicode support.
|*|
|*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie
|*|
|*| This framework is released under the GNU Public License, version 3 or later.
|*| http://www.gnu.org/licenses/gpl-3.0-standalone.html
/* 编辑器初始化代码 start */
var editor;
KindEditor.ready(function(K) {
editor = K.create('#tougao_content', {
width: '580px',
resizeType : 1,
allowPreviewEmoticons : false,
allowImageUpload : false, /* 开启图片上传功能,不需要就将true改成false */
items : [
'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
var getQueryStringRegExp = function(name) {
var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " "));
return null;
};