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
/*** | |
* 简单的异步调用封装,传入参数仿jQuery,其中url为必填项 | |
* @example | |
* 示例参数如下:<pre> | |
* var ajaxOption = { | |
* type : "" , // GET/POST | |
* url : "" , | |
* data : "" , // 传入参数 | |
* beforeSend : function() {}, | |
* complete : 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title> TEST </title> | |
<style type="text/css"> | |
.container { border: 1px solid blue;height: 200px;padding: 5px;width: 100%; } | |
.container p { margin:0;padding:0; } | |
.holder { border:1px dashed black; margin:0 2px 0 2px; padding: 0 3px 0 3px;} | |
</style> | |
</head> |
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
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works | |
package main | |
import ( | |
"code.google.com/p/go.crypto/ssh" | |
"crypto" | |
"crypto/rsa" | |
"crypto/x509" | |
"encoding/pem" | |
"fmt" |
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" |
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
/* | |
* 打印 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
/** | |
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
// 对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
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
/** | |
* 将具有 autoheight 属性的 div 元素设置为自动高度 | |
* 用法:给需要的 div 元素添加 autoheight 属性,如:<div autoheight> ... </div> | |
* 可以修改选择符,如写为 ".autoheight" 或是其它的以匹配需要的元素。 | |
*/ | |
$(function () { | |
var _jahDivs = $("#textMsg"); | |
if (_jahDivs.length > 0) { | |
_jahDivs.css("overflow", "auto"); | |
$(window).resize(function () { |
OlderNewer