Skip to content

Instantly share code, notes, and snippets.

@jakeauyeung
jakeauyeung / gist:b7d6e77fc8d1f11bcb45
Created December 11, 2014 06:34
数组合并去重
var _user01 = [
{'id': '11', 'name': 'fame'},
{'id': '11'},
{'id': '22'}
]
var _user02 = [
{'id': '11', 'name': 'fame', 'sex': 'famle'},
{'id': '11', 'sesd':'2343'},
{'id': '22'},
@jakeauyeung
jakeauyeung / array
Created December 11, 2014 06:33
数组去重
var _user = [
{'id': '11', 'name': 'fame'},
{'id': '11'},
{'id': '22'}
],
newArr = []
for(var i = 0,len = _user.length; i < len; i++){
for(var j = i + 1; j < len; j++){
if(_user[i]['id'] == _user[j]['id']){
@jakeauyeung
jakeauyeung / panel
Created November 20, 2014 11:02
Panel Directive For angularjs
/*<tabs> //expalme
<pane title="First Tab">
<div><h4>This is the content of the first tab.</h4></div>
</pane>
<pane title="Second Tab">
<div>This is the content of the second tab.</div>
</pane>
</tabs>
*/
@jakeauyeung
jakeauyeung / goto.js
Created August 8, 2014 03:00
回到顶点2方法
/*goto top*/
.gotop{
position: absolute;
right: -148px;
bottom: 30px;
color: #000;
width: 124px;
z-index: 999;
}
@jakeauyeung
jakeauyeung / gist:d8d42470b33545d2a19b
Created July 31, 2014 11:11
div外层点击关闭
// 弹层
document.onclick = function(e){
$('.product_info').removeClass('cur');
}
$('.product_info').click(function(e){
e = e||event; stopFunc(e);
});
$(".arrow-link").click(function(e) {
@jakeauyeung
jakeauyeung / hd.html
Last active August 29, 2015 14:04
活动每天10点到12点
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript" src="http://cdn.staticfile.org/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
<script type="text/javascript">
@jakeauyeung
jakeauyeung / sku
Created July 15, 2014 02:29
SKU算法
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>sku</title>
<meta name="keywords" content="关键字" />
<meta name="description" content="页面描述" />
<style type="text/css">
.bh-sku-selected {color: red;}
@jakeauyeung
jakeauyeung / dome
Created July 15, 2014 02:28
编写一个JS组建
window.dome = (function() {
function Dome(els) {
for(var i = 0; i < els.length; i++) {
this[i] = els[i];
}
this.length = els.length;
}
var dome = {
@jakeauyeung
jakeauyeung / addByTransDate.js
Created June 16, 2014 05:34
根据指定的一个日期和相差的天数,获取另外一个日期,dateParameter为指定已经存在的日期yyyy-MM-dd num为相差天数为整型
function addByTransDate(dateParameter, num) {
var translateDate = "",
dateString = "",
monthString = "",
dayString = "";
translateDate = dateParameter.replace("-", "/").replace("-", "/");;
var newDate = new Date(translateDate);
newDate = newDate.valueOf();
@jakeauyeung
jakeauyeung / datadiff.js
Last active August 29, 2015 14:02
计算2个日期的相差天数
Date.prototype.Format = function(fmt) {
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};