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
package pkgName; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Set; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
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
package pckName | |
import org.springframework.beans.BeansException; | |
import org.springframework.beans.factory.NoSuchBeanDefinitionException; | |
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.ApplicationContextAware; | |
// | |
// 使用 SpringContextUtil.getBean(SchedulerFactoryBean.class); | |
// <bean class="pckName.SpringContextUtil" scope="singleton"></bean> |
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
//$package("js.lang"); // 没有包管理时,也可简单写成 js = {lang:{}}; | |
js = {lang:{}}; | |
js.lang.String = function(){ | |
this.REGX_HTML_ENCODE = /"|&|'|<|>|[\x00-\x20]|[\x7F-\xFF]|[\u0100-\u2700]/g; | |
this.REGX_HTML_DECODE = /&\w+;|&#(\d+);/g; | |
this.REGX_TRIM = /(^\s*)|(\s*$)/g; | |
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
/** | |
* 将具有 autoheight 属性的 div 元素设置为自动高度 | |
* 用法:给需要的 div 元素添加 autoheight 属性,如:<div autoheight> ... </div> | |
* 可以修改选择符,如写为 ".autoheight" 或是其它的以匹配需要的元素。 | |
*/ | |
$(function () { | |
var _jahDivs = $("#textMsg"); | |
if (_jahDivs.length > 0) { | |
_jahDivs.css("overflow", "auto"); | |
$(window).resize(function () { |
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
var getLength = (function() { | |
var trim = function(h) { | |
try { | |
return h.replace(/^\s+|\s+$/g, "") | |
} catch (j) { | |
return h | |
} | |
} | |
var byteLength = function(b) { | |
if (typeof b == "undefined") { |
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
// 对Date的扩展,将 Date 转化为指定格式的String | |
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, | |
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) | |
// 例子: | |
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 | |
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 | |
Date.prototype.Format = function (fmt) { //author: meizz | |
var o = { | |
"M+": this.getMonth() + 1, // 月份 | |
"d+": this.getDate(), // 日 |
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
/** | |
Implement pluck, which takes an array of objects and a property name, | |
and returns an array containing the named property of each object. | |
For example: | |
pluck([{a:1}, {a:2}], 'a') // -> [1,2] | |
If an object is missing the property, you should just leave it as undefined in the output array. | |
*/ | |
// mine |
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
/* | |
* 打印 JavaScript 函数调用堆栈 | |
*/ | |
function printCallStack() { | |
var i = 0; | |
var fun = arguments.callee; | |
do { | |
fun = fun.arguments.callee.caller; | |
console.log(++i + ': ' + fun); | |
} while (fun); |
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 nthFibo(n) { | |
var Phi = (1 + Math.sqrt(5))/ 2; | |
return Math.round ((Math.pow(Phi, (n-1)) - Math.pow(Phi*-1, (n-1)*-1)) / Math.sqrt(5)) | |
} |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"io/ioutil" | |
"log" | |
"code.google.com/p/go.crypto/ssh" | |
"code.google.com/p/go.crypto/ssh/terminal" |