duangsuse::Echo
#China #Low #weibo
https://github.com/FirefoxBar/HeaderEditor/blob/master/src/background.js HeaderEditor 的 response body 修改 #Learn #JavaScript
解码用到了新的 ArrayBuffer / TypedArray API
传统的 Message 化控制流扩展
WebExtensions ContextMenus API
常见的 BrowserAction
还有许多不能直接发上来了,只有简化版,待会还有一个 time limited cache,看看。
解码用到了新的 ArrayBuffer / TypedArray API
browser.runtime.onMessage.addListener(function(request, sender, sendResponse) 传统的 Message 化控制流扩展
if (browser.contextMenus != undefined)
browser.contextMenus.onClicked.addListener((info, tab) => { WebExtensions ContextMenus API
browser.browserAction.setIcon({ path: "" }) 常见的 BrowserAction
_textEncode(encoding, text) {
let encoder = this._textEncoder.get(encoding); //cache
if (!encoder) {
// UTF-8使用原生API,性能更好
if (encoding === "UTF-8" && window.TextEncoder) {
encoder = new window.TextEncoder();
} else {
encoder = new TextEncoder(encoding, { NONSTANDARD_allowLegacyEncoding: true });
}
this._textEncoder.set(encoding, encoder);
}
// 防止解码失败导致整体错误
try {
return encoder.encode(text);
} catch (e) {
console.log(e);
return new Uint8Array();
}
} 还有许多不能直接发上来了,只有简化版,待会还有一个 time limited cache,看看。
GitHub
FirefoxBar/HeaderEditor
Manage browser's requests, include modify the request headers and response headers, redirect requests, cancel requests - FirefoxBar/HeaderEditor
Forwarded from duangsuse Throws
#dev #JavaScript #Haha 草,我竟然做出来了……
一个车夫,赶着1辆马车,车上坐着5个人,每人拿着5个袋子,每个袋子里装着5只大猫,
每只大猫带5只小猫,每只小猫带着5只老鼠干粮
问:这道题里一共有多少条腿? 😂
衬衫的价格是 9 磅 15 便士。ES6。
一个车夫,赶着1辆马车,车上坐着5个人,每人拿着5个袋子,每个袋子里装着5只大猫,
每只大猫带5只小猫,每只小猫带着5只老鼠干粮
问:这道题里一共有多少条腿? 😂
衬衫的价格是 9 磅 15 便士。ES6。
constanswer = cheche(1) //13104
laoshu = n => n*4,
mao = n => laoshu(n)*5 + 4,
bigmao = n => mao(n)*5 + 4,
daizi = n => bigmao(n)*5,
ren = n => daizi(n)*5 + 2,
cheche = n => 2 + ren(5);
Forwarded from 憨憨的碎碎念 | #成为打工人 (Channel Helper)
===== 评论区 =====
duangsuse: https://t.me/dsuset/7251
wuhang2003 - 疯狂...: (➤duangsuse) 同学给的答案是 15516,某搜题软件提供的答案是 15512 ,怎么说这差距也太大了🌚
duangsuse: https://t.me/dsuset/7251
constanswer = cheche(1) //13104
laoshu = n => n*4,
mao = n => laoshu(n)*5 + 4,
bigmao = n => mao(n)*5 + 4,
daizi = n => bigmao(n)*5,
ren = n => daizi(n)*5 + 2,
cheche = n => 2 + ren(5);
wuhang2003 - 疯狂...: (➤duangsuse) 同学给的答案是 15516,某搜题软件提供的答案是 15512 ,怎么说这差距也太大了🌚
Telegram
duangsuse Throws
#dev #JavaScript #Haha 草,我竟然做出来了……
一个车夫,赶着1辆马车,车上坐着5个人,每人拿着5个袋子,每个袋子里装着5只大猫,
每只大猫带5只小猫,每只小猫带着5只老鼠干粮
问:这道题里一共有多少条腿? 😂
衬衫的价格是 9 磅 15 便士。ES6。
const
laoshu = n => n*4,
mao = n => laoshu(n)*5 + 4,
bigmao = n => mao(n)*5 + 4,
daizi = n => bigmao(n)*5,
ren = n…
一个车夫,赶着1辆马车,车上坐着5个人,每人拿着5个袋子,每个袋子里装着5只大猫,
每只大猫带5只小猫,每只小猫带着5只老鼠干粮
问:这道题里一共有多少条腿? 😂
衬衫的价格是 9 磅 15 便士。ES6。
const
laoshu = n => n*4,
mao = n => laoshu(n)*5 + 4,
bigmao = n => mao(n)*5 + 4,
daizi = n => bigmao(n)*5,
ren = n…
https://github.com/itorr/homo/blob/master/homo.js#L1 #JavaScript #code
核心代码,首先我们有一个类似这样的表,
核心代码,首先我们有一个类似这样的表,
eval(xs[i]) == i : ["1", "2"]function divmod(a, b) { return [Math.trunc(a/b), a%b]; }
function ordFinder(xs, cmp, is_descending = false) {
const sorted = is_descending? xs.sort((a, b) => b-a) : xs.sort();
return function finder(n) {
for (let x of xs) if (cmp(x, n)) return x;
};
}
const findMaxLT = ordFinder(predefined, (a, b) => a < b, true);
function demolish(num) {
if (typeof num != "number") return "";
if (num < predefined.length) return predefined[num];
let [k, div] = divmod(num, findMaxLT(num) );
return `({demolish(k)}*{div}+{deomolish(mod)})`. replace(/\*\(1\)/, "") //*1=itself
}
开始我还以为是自动构造数学表达式然后 filter 呢……GitHub
homo/homo.js at master · itorr/homo
💩「恶臭数字论证器」数字恶臭化工具. Contribute to itorr/homo development by creating an account on GitHub.
#web #PLT #JavaScript #zhihu https://www.zhihu.com/question/385711203#write
牛逼啊,竟然还扯出了 extonic object, 稀疏数组, 2^53-1 一大堆术语
牛逼啊,竟然还扯出了 extonic object, 稀疏数组, 2^53-1 一大堆术语
Zhihu
为什么js没有array初始大小和扩容的概念? - 知乎
在谈论js时,很少听人谈论array,object等引用型数据类型初始大小以及扩容的问题?这是为什么?也没有听…
function* readSourceTable(text) { //< obsoleted
let entries = text.split("\n\n");
for (let entry of entries) {
let entryList = [];
let key = null; let content = "";
for (let line of entry.split("\n").map(it => it.trim())) {
if (line.length == 0) continue;
if (line.endsWith(":")) {
if (key != null) entryList.push([key, content]);
key = line.substring(0, line.length-1); content = "";
} else content += `${line}\n`;
}
entryList.push([key, content]);
yield entryList;
}
} #JavaScript #web 丢掉的代码,虽然也不怎么厉害