Skip to content

Instantly share code, notes, and snippets.

View FatalMerlin's full-sized avatar
🧙
Magic

Merlin FatalMerlin

🧙
Magic
View GitHub Profile
@FatalMerlin
FatalMerlin / example.ts
Created November 24, 2021 13:57
grammY ctx.api.config.use payload type-check
ctx.api.config.use((prev, method, payload) => {
if (isPayloadOfType(payload, method, 'sendMessage')) {
// payload is now of type Payload<'sendMessage', R>
payload.reply_markup = {
...payload.reply_markup,
keyboard: numberKeyboard.build(),
};
}
return prev(method, payload);
@FatalMerlin
FatalMerlin / script.sh
Created February 13, 2022 19:53
How to check if package from list file is not installed with apt
xargs -a packages.txt apt -qq list | grep -v "\[install" | awk '$3 == "amd64" {print $1}'
@FatalMerlin
FatalMerlin / HTML Snippet.html
Last active August 4, 2023 20:56
SoSciSurvey - Hide submit button until first audio on page played
<script type="text/javascript">
SoSciTools.submitButtonsHide();
SoSciTools.attachEvent(window, 'load', function () {
let audio = document.getElementsByTagName('audio')[0];
audio.onended = () => {
window.setTimeout(SoSciTools.submitButtonsDisplay, 1000);
};
});
</script>