Skip to content

Instantly share code, notes, and snippets.

View redblue9771's full-sized avatar
👀
Studying at freeCodeCamp

赤琦 redblue9771

👀
Studying at freeCodeCamp
View GitHub Profile
@redblue9771
redblue9771 / README-Template.md
Last active May 29, 2019 03:57 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system

Prerequisites

@redblue9771
redblue9771 / Tween.js
Created May 10, 2019 09:01 — forked from xyqfer/Tween.js
缓动算法
/*
* Tween.js
* t: current time(当前时间);
* b: beginning value(初始值);
* c: change in value(变化量);
* d: duration(持续时间)。
* you can visit 'http://easings.net/zh-cn' to get effect
*/
var Tween = {
@redblue9771
redblue9771 / easing.js
Created May 12, 2019 06:58 — forked from RienNeVaPlus/easing.js
Simple Easing Functions in JavaScript using `export`
/**
* Easing functions
*
* https://gist.github.com/gre/1650294
* http://easings.net
*/
// no easing, no acceleration
export function easeLinear(t){ return t; }
// accelerating from zero velocity
export function easeInQuad(t){ return t*t; }
@redblue9771
redblue9771 / formatTime.js
Created July 12, 2019 14:15
JavaScript中一些时间功能的实现 - 格式化时间戳(yy/mm/dd hh:MM)
/**
* 格式化时间戳 格式:yy/mm/dd hh:MM
* @param time 时间戳
* @returns {string} yy/mm/dd hh:MM
*/
function formatTime(time) {
var date = new Date(time);
var year = date.getFullYear();
var month = date.getMonth() + 1;
var days = date.getDate();
@redblue9771
redblue9771 / checkTime.js
Created July 12, 2019 14:16
JavaScript 中一些时间功能的实现 - 检查平润年,返回正确月份的天数
/**
* 检查平润年,返回正确月份的天数
* @param year 年份
* @param month 月份
* @returns {number} 该月正确的天数
*/
function checkTime(year, month) {
if (month === 2) return (year % 4 === 0 && year % 100 !== 0 || year % 400) === 0 ? 29 : 28;
return '4;6;9;11'.indexOf(month + ';') === -1 ? 31 : 30;
}
@redblue9771
redblue9771 / countDown.js
Created July 12, 2019 14:17
JavaScript 中一些时间功能的实现 - 倒计时
/**
* 倒计时
* @param now 现在的时间
* @param startTime 计时开始时间
* @param endTime 计时结束时间
* @returns {*} 计时标识
*/
function countDown(startTime, endTime) {
var now = Date.now();
if (now < startTime) {
@redblue9771
redblue9771 / returnTime.js
Created July 12, 2019 14:18
JavaScript 中一些时间功能的实现 - 给一个时间戳,返回距离现在多久了
/**
* 给一个时间戳,返回距离现在多久了
* @param time 一个时间戳
* @returns {*} 时间差
*/
function returnTime(time) {
if (isNaN(time) === true)
return "Error!" + '"' + time + '"' + " is NaN";
if (time < 0) return "Error! 过去的时间大于现在的时间!";
else {
@redblue9771
redblue9771 / stylus.json
Last active November 13, 2019 06:19
styles
[
{
"installDate": 1534259003610,
"enabled": true,
"updateUrl": "https://userstyles.org/styles/chrome/130739.json",
"md5Url": "https://update.userstyles.org/130739.md5",
"url": "http://userstyles.org/styles/130739",
"originalMd5": "dc4cddc4ac86caaac18a24e2eaea4255",
"sections": [
{
@redblue9771
redblue9771 / index.css
Last active December 1, 2019 22:07
Awesome Timeline
.main-timeline{
overflow: hidden;
position: relative;
padding: 60px 0;
}
.main-timeline:before{
content: "";
width: 1px;
height: 100%;
background: #cfcdcd;
@redblue9771
redblue9771 / git-clear-cache.sh
Created December 8, 2019 16:52 — forked from joemaffia/git-clear-cache.sh
Clear git cache
git rm -r --cached .
git add .
git commit -am 'git cache cleared'
git push