Skip to content

Instantly share code, notes, and snippets.

View hh54188's full-sized avatar
😎
Born to code

Guangyi Li hh54188

😎
Born to code
View GitHub Profile
@hh54188
hh54188 / Decode ways algorithm
Created April 11, 2023 15:46
Decode ways algorithm
var numDecodings = function (s) {
const availableNumStr = {};
const cache = {}
let i = 1;
// 首先标记哪些数字可以解码为字母
while (i < 27) {
availableNumStr[i.toString()] = true;
i++;
}
@hh54188
hh54188 / promise_sequentially.js
Created November 7, 2018 15:22
promise sequentially
// https://hackernoon.com/functional-javascript-resolving-promises-sequentially-7aac18c4431e
// https://decembersoft.com/posts/promises-in-serial-with-array-reduce/
function delay() {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('RESOLVED')
resolve()
}, 1000 * 1)
})
}
// http://a.tbcdn.cn/p/mall/2.0/js/direct-promo.js
/**
* 钻石平台定投广告
*
* @creator [email protected]
* @depends ks-core
*/
KISSY.use('core', function(S){
/**