Skip to content

Instantly share code, notes, and snippets.

View neekey's full-sized avatar
🎯
Focusing

Neekey neekey

🎯
Focusing
View GitHub Profile
@neekey
neekey / cacheTest
Created April 14, 2012 06:36
browser cache test
var http = require("http");
var fs = require("fs");
var url = require("url");
var path = require("path");
var transferFile = function (request, response) {
var uri = url.parse(request.url).pathname;
var filepath = path.join(process.cwd(), uri);
path.exists(filepath, function (exists) {
@neekey
neekey / YUICompressor.sh
Created April 20, 2012 05:50
YUI Compressor Shell
#!/bin/sh
# YUI compressor shell 简单脚本
# params:
# -f 需要压缩的文件名
# -o 输出文件名
# -c 压缩编码
# 使用说明:
# 在~/.profile 中为本脚本的执行添加一个别名比如:
# alias yui="/users/neekey/yuicompressor.sh"
# 然后进入需要压缩文件的目录:
@neekey
neekey / mongoose.find.example.js
Created April 29, 2012 11:40
mongoose常用的集中find方式
var DB = require( '../../database/' );
var mongoose = require( 'mongoose' );
var Item = mongoose.model( 'item' );
describe( 'mongooseTest', function(){
it( 'localtion test', function(){
var itemsLen = 0;
@neekey
neekey / senchaTouchRouteEnhance.js
Created May 8, 2012 08:12
Sencha Touch 1 路由功能增强
(function(){
var Mods = App.mods;
var DefaultAction = 'index';
Mods.route = (function (){
var Route = {
/**
* 设置hash
@neekey
neekey / acfun.css
Created May 11, 2012 15:29
acfunCss
body{ background-image: url(http://s.acfun.tv/h/Images/Upload/225d3b6b-de84-4d6c-bf67-477d5b9a28e2.jpg)!important; background-repeat: no-repeat!important; background-position: 0px 0px!important; background-attachment: fixed!important; background-size: cover!important; }
#stage{ background-color: rgba(0, 0, 0, 0)!important; }
#header{ height: 128px!important; background: url() 0px 0px repeat-x!important; }
#area-topic{ background-color: rgba(255, 255, 255, 0.5)!important; border-radius: 15px 15px 0px 0px!important; }
#list-topic-third{ width: 280px!important; height: 200px!important; margin-left: 20px!important; border-radius: 4px!important; overflow: hidden!important; background-color: rgba(0, 0, 0, 0)!important; }
#header{ border-bottom: 0px solid #ccc!important; }
#mainer{ border-top: 0px solid #f9f9f9!important; }
#ad-index{ display: none!important; }
.tabbable{ background-color: rgba(0, 0, 0, 0)!important; }
#area-link{ opacity: 0.9!important; }
@neekey
neekey / mongooseGeoSerach.js
Created May 22, 2012 15:09
Mongoose 地理位置搜索 代码示例
/**
* 商品种类
*/
var Location = new schema({
// 地点位置
name: { type: String, required: true },
// 位置GPS坐标
location: { type: Array, index: "2d" }
});
@neekey
neekey / getOSInfo.js
Created July 26, 2012 02:47
获取操作系统信息
var getOSInfo = function() {
var ua = navigator.userAgent;
// Ref: http://msdn.microsoft.com/en-us/library/ms537503%28VS.85%29.aspx
var token = [
// 顺序无关,根据占用率排列
["Windows NT 5.1", "WinXP"],
["Windows NT 6.0", "WinVista"],
["Windows NT 6.1", "Win7"],
["Windows NT 5.2", "Win2003"],
["Windows NT 5.0", "Win2000"],
@neekey
neekey / getBrowserInfo.js
Created July 26, 2012 02:48
获取浏览器信息
var getBrowserInfo = function() {
var ua = navigator.userAgent;
// Ref: http://www.useragentstring.com/pages/useragentstring.php
var token = [ // 顺序有关
"Opera", // 某些版本会伪装成 MSIE, Firefox
"Chrome", // 某些版本会伪装成 Safari
"Safari", // 某些版本会伪装成 Firefox
"MSIE 6",
"MSIE 7",
"MSIE 8",
@neekey
neekey / getScreenInfo.js
Created July 26, 2012 02:49
获取屏幕分辨率
/**
* 获取屏幕分辨率
*/
var getScreenInfo = function() {
var screen = window.screen;
return screen ? screen.width + 'x' + screen.height : '';
};
@neekey
neekey / object.keys.js
Created July 26, 2012 03:27
Object.keys方法实现
Object.keys = (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString:null}).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',