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
$margin-unit: 4; | |
$padding-unit: 4; | |
$spacing-modifiers: ( | |
'ma': margin, | |
'mx': margin, | |
'my': margin, | |
'mt': margin-top, | |
'mr': margin-right, | |
'mb': margin-bottom, |
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
let retry = function(fn, maxTime) { | |
let counter = 0; | |
function execFunc () { | |
return new Promise((resolve, reject) => { | |
console.log(`第${counter}次请求`); | |
resolve(fn); | |
}).then(res => { | |
return Promise.resolve(res); | |
}).catch(e=>{ | |
counter += 1; |
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 generatePromiseFunc(index) { | |
return function () { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log(index) | |
resolve(index) | |
}, 1000) | |
}) | |
} | |
} |
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
const fib = (num) => { | |
if (num <= 0) return 0; | |
if (num === 1 || num === 2) return 1; | |
if (num > 2) { | |
let prev = 1, next = 1; | |
for (let i = 3; i <= num; i++) { | |
let sum = prev + next; | |
prev = next; | |
next = sum; | |
} |
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
String.prototype.capFirstLetter = function() { | |
let [first, ...rest] = this.split(''); | |
return first.toUpperCase() + rest.join(''); | |
}; |
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
Array.prototype.equals = function (arr) { | |
if(arr.length !== this.length) { | |
return false; | |
} | |
for (var i = arr.length - 1; i >= 0; i--) { | |
if (this[i] !== arr[i]) { | |
return false; | |
} | |
} | |
return true; |
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
git log --oneline --format=%B -n 1 HEAD | head -n 1 | |
git log --oneline --format=%B -n 1 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css"> | |
<title>JS Bin</title> | |
<script src="https://code.jquery.com/jquery.min.js"></script> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> |
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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
0.0 | 0.0 | |
---|---|---|
1.1 | 1.1 | |
3.5 | 4.5 | |
2.2 | 2.2 | |
0.1 | 1.0 | |
2.1 | 1.2 | |
3.1 | 1.3 |
NewerOlder