This file contains hidden or 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
for recording some notes |
This file contains hidden or 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
/*jshint strict:false*/ | |
/*global CasperError console phantom require*/ | |
/** | |
* grab links and push them into xml | |
*/ | |
var casper = require("casper").create({ | |
}); |
This file contains hidden or 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
1, tooltip | |
简介: 弹出提示框功能 | |
功能: hover 或 click 触发 | |
ajax加载内容 | |
与弹出框交互功能(interactive) | |
自定调整弹出框位置(autoPosition) | |
动画效果 'fade' 'zoom' | |
2, colorInput | |
简介: 功能强大的颜色选择器功能 |
This file contains hidden or 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
marker.$element.on('focus', function() { | |
$doc.on('keydown.' + marker._id, function(e) { | |
var key = e.keyCode || e.which; | |
if (key === 46) { | |
self.del(marker); | |
} | |
}); | |
}).on('blur', function() { | |
$doc.off('keydown.' + marker._id); | |
}); |
This file contains hidden or 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
<a class="no-href" href="">test</a>; | |
$('.no-href').on('click', function(){ | |
// do some stuff | |
// some error happens | |
return false; | |
}); | |
bug: 没有在href上面加内容时,会造成发生错误时候自动跳转,错误被忽略,偶尔会出现断点也无法跟踪的现象。 | |
解决方法: 在href上面加个#使之不跳转。 |
This file contains hidden or 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 API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
This file contains hidden or 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.exports = function (options) { | |
var randFn = (options && options.fn) || Math.random; | |
function random(schema, options) { | |
var path = (options && options.path) || 'random'; | |
var field = {}; | |
field[path] = { | |
type: { type: String, default: 'Point' }, | |
coordinates: { type: [Number], default: function () { return [randFn(), randFn()] } } | |
}; |
This file contains hidden or 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
var nodemailer = require('nodemailer'); | |
var config = require('../config/config.js'); | |
// Create a SMTP transport object | |
var transport = nodemailer.createTransport("SMTP", { | |
service: config.email.service, | |
auth: { | |
user: config.email.user, | |
pass: config.email.pass | |
} |
This file contains hidden or 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 getTransitionEndEventName() { | |
var obj = { | |
TransitionEvent: "transitionend", | |
WebKitTransitionEvent: "webkittransitionEnd", | |
OTransitionEvent: "OTransitionEnd", | |
otransitionEvent: "otransitionEnd", | |
MSTransitionEvent: "MSTransitionEnd" | |
} | |
// var ev = document.createEvent("TransitionEvent"); // FIXME: un-specified | |
// ev.initTransitionEvent("transitionend", true, true, "some-unknown-prop", -4.75); |
This file contains hidden or 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
Client = (function() { | |
var d = {engine: {ie: 0,gecko: 0,webkit: 0,opera: 0,khtml: 0},browser: {ie: 0,firefox: 0,chrome: 0,opera: 0,safari: 0,konq: 0}}; | |
var b = navigator.userAgent; | |
var c = d.engine; | |
var a = d.browser; | |
if (window.opera) { | |
a.version = c.version = window.opera.version(); | |
a.opera = c.opera = parseFloat(c.version) | |
} else { | |
if (/AppleWebKit\/(\S+)/.test(b)) { |