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
document.getElementById=(function(func){ | |
return function(){ | |
return func.apply(document,arguments); | |
} | |
})(document.getElementById); | |
var getId = document.getElementById; | |
var div = getId('div1'); | |
console.log(div.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
// 对参数进行断言,确定类型并获取参数 | |
if targetParam, ok := params["a"].([]interface{}); ok { | |
for _, param := range targetParam { | |
switch v := param.(type) { | |
case string: | |
paramArr = append(paramArr, v) | |
case float64: | |
paramArr = append(paramArr, strconv.FormatFloat(v, 'f', 0, 64)) | |
case int64: | |
paramArr = append(paramArr, strconv.FormatInt(v, 10)) |
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
// readTestFile 按行读取配置文件 | |
func readTestFile(path string) []string { | |
var arr []string | |
file, err := os.Open(path) | |
if err != nil { | |
fmt.Println(err) | |
return arr | |
} | |
defer file.Close() |
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
package node | |
type node struct { | |
key string // 键名 | |
count int // 总个数 | |
} | |
type nodeList []node | |
func (nl nodeList) Len() int { |
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
/** | |
* CharacterUtils | |
* | |
* @author Laughing | |
* @date 2018/7/11 15:24 | |
* Description: | |
*/ | |
public class CharacterUtils { | |
/** | |
* 判断一个字符是否是中文 |
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
单行文本方法, 通过CSS即可解决 | |
<style> | |
p{ | |
width: 100px; | |
display: block; | |
text-overflow: ellipsis; | |
-o-text-overflow: ellipsis; | |
-icab-text-overflow: ellipsis; | |
-khtml-text-overflow: ellipsis; |