Skip to content

Instantly share code, notes, and snippets.

View dreamsky's full-sized avatar
🎯
Focusing

Andy Lee dreamsky

🎯
Focusing
View GitHub Profile
@dreamsky
dreamsky / paging.js
Last active December 19, 2015 19:19
jQuery 分页插件
$.extend({
paging : function(options) {
var default_configs = {
container: null,
total_count: 0,
page_size: 0,
cur_page: 0,
list_count: 5,
goPage: function(page_num) {}
};
@dreamsky
dreamsky / time-diff.js
Last active December 18, 2015 13:48
时间差计算
function DateDiff(interval, date1, date2) {
var longl = date2.getTime() - date1.getTime(); //相差毫秒
switch (interval.toLowerCase()) {
case "y":
return parseInt(date2.getFullYear() - date1.getFullYear());
case "m":
return parseInt((date2.getFullYear() - date1.getFullYear()) * 12 + (date2.getMonth() - date1.getMonth()));
case "d":
return parseInt(longl / 1000 / 60 / 60 / 24);
case "w":
@dreamsky
dreamsky / magnifier.html
Created June 10, 2013 06:29
前端试题:图片放大镜
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Magnifier Demo</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
@dreamsky
dreamsky / callee.js
Last active February 12, 2020 10:08
优秀的 JavaScript 代码片段集合
//JavaScript callee 用法示例
function factorial(num) {
if (num <= 1) {
return 1;
} else {
return num * arguments.callee(num - 1);
}
}
@dreamsky
dreamsky / css3.html
Last active December 17, 2015 20:38
CSS3 效果:绚丽的动画按钮
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS3 Amazing Effects</title>
<style>
@import url(http://fonts.googleapis.com/css?family=Terminal+Dosis);
html {
background-color: hsl(0,0%,18%);
@dreamsky
dreamsky / css3-metal-button.html
Created May 29, 2013 07:38
CSS3 效果:金属质感按钮
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS3 Button Effects</title>
<style>
body {
font-family:'museoslab500';
text-transform: uppercase;
background: #333;
@dreamsky
dreamsky / css3-font-animation
Created May 29, 2013 07:32
前端试题:CSS3 文字放大效果
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>前端试题:CSS3 文字放大效果</title>
</head>
<style>
a {
display: table-cell;
width: 220px;
@dreamsky
dreamsky / nine-grid.html
Created May 29, 2013 07:11
前端试题:CSS 九宫格效果
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Nine Grid</title>
<style>
ul {
width: 165px;
padding: 30px;
}
@dreamsky
dreamsky / dabblet.css
Created May 29, 2013 06:39
Dabblet Demo
/**
* Dabblet Demo
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;