@maz@niu.moe that’s true now i remember that...

@maz@niu.moe tried that and it tasted like kitkat... :/

@thor@snabeltann.no @mattskala but i agree with you that it would be nice if JS could natively support parallelizing or serializing execution via more syntactic sugar such as:

let res = await parallel requestA(), requestB();

Promise.all() feels ugly and old :P

@thor@snabeltann.no @mattskala typo.. should be:

let res = await Promise.all(requestA(), requestB());

@thor@snabeltann.no @mattskala if you want parallel execution you and await on a Promise.all():

async function requestA() ...
async function requestB() ...
...
let res = await Promise.all(requestA, requestB);
// process results from both requests

@thor@snabeltann.no @mattskala for async-await this is a good introduction: javascript.info/async-await

basically an async function always returns a promise. await "waits" for the promise to resolve and execute the next line in your code.

the best thing is you can write asynchronous code just as if you are writing synchronous code, and you can try-catch any asynchronous failure.

very simple example:
try {
let res = await makeHttpCall(URL);
// process result
} catch (err) {
// catch error.
}

@mattskala @thor@snabeltann.no what you described is basically async-await?

@g yeah.. it's really hard to get all use cases covered so the better route, if possible, is to urlencode any attribute values.

@g how about this:
<\s*[\w-]+(\s*[\w-]+\s*=\s*"[^"]+")*\s*>

@g hmm you are right my regex would balk at your html string inside data-tag. i need to fix it by also matching attr=value pairs inside any tags...

Four Legs boosted

#診所故事

溝通好重要。(Part 2)

我當時好清楚地提醒主人「佢而家個樣咁精神純粹係因為有鹽水幫佢吊命,一切都係假象。鹽水一拆佢只可以頂到 24-48小時,我希望你哋做定心理準備」

主人好明白。

48 小時後,未見佢哋帶狗狗黎診所,我打返去問,佢哋話我知大概到第 26 小時開始,狗狗不停瞓,之後陷入昏迷,之後好安詳地走了。

之後主人好有心,寄咗張感謝卡去診所。

成件事,我認為重點係

一) 「溝通」。其實只要你用心同主人溝通,我相信好多主人都會感受到。主人需要嘅唔係 false hope。(橫蠻主人例外,下回分享)

二) 動物表現同佢真實病情無絕對關係,所以主人們唔好單憑你嘅寵物「睇落好精神」而認為佢健康無問題,到最終醫唔返就話係醫生唔識醫

三) 你嘅寵物同你一樣,唔鍾意孤令令一個留院,可以嘅話多D 去探佢哋,比多 D 支持佢哋 - 當然要就返個別醫院嘅探病時間啦。

Four Legs boosted

#診所故事

溝通好重要。(Part 1)

我記得好多年前,有隻狗狗腎衰竭。按慣例都係住醫院吊鹽水三日,再覆驗指數睇下點。

嗰隻係一隻小狗,太多年唔記得品種。重點係,住咗三日院吊咗三日鹽水之後,腎指數只係微跌,主人決定再吊多三日,再多三日之後,指數不跌反升。

我印象好深刻嘅係,狗狗除咗唔肯食之外,表面睇無咩異常,見到主人黎探病嗰陣仲興奮到喺籠度彈下彈下好似無病一樣!

我拎住個血報告同主人講「睇佢目前表現真係唔覺得佢有咁嚴重,但報告顯示佢個腎已經無晒排毒功能,吊鹽水只係吊命」

同主人傾咗好耐之後,佢決定帶狗狗返屋企好好道別之後先帶返黎打針。

我同意佢哋嘅決定,因為吊咗六日鹽水都無幫助,狗狗其實已經喺死亡邊緣,但佢一見到主人就表現得好精神好開心,無人會忍心喺呢個時候幫佢打針。

@zangetsu_MG cool thx for the pointer! this reminds me of sierra outpost, a really old game.

@g pretty much! it's a regex for html5 tags with 4 capture groups - open tags (e.g. <div>), close tags (e.g. </div>), self closing tags (e.g. <br />), and a substitution variables (${xxx}).

just wrote an ugly regex...

/(<[^\/>]+>)|(<\s*\/[^>]*>)|(<[^\/>]+\/\s*>)|(\${[^}]+})/g

.\ /. -___- X___X

@varx @zperrault yeah i know... i've dripped my own coffee every morning for years so i might be a good candidate for category two :)

Show older
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!