Skip to content

Instantly share code, notes, and snippets.

View dcts's full-sized avatar
πŸ’­
probably coding

dcts dcts

πŸ’­
probably coding
View GitHub Profile
@dcts
dcts / download_object_as_json.js
Last active December 9, 2022 11:54
download_object_as_json.js
// taken from here => https://stackoverflow.com/a/30800715/6272061
function downloadObjectAsJson(exportObj, exportName){
var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportObj, null, 2));
var downloadAnchorNode = document.createElement('a');
downloadAnchorNode.setAttribute("href", dataStr);
downloadAnchorNode.setAttribute("download", exportName + ".json");
document.body.appendChild(downloadAnchorNode); // required for firefox
downloadAnchorNode.click();
downloadAnchorNode.remove();
}
@dcts
dcts / test.js
Created February 22, 2023 18:04
console.log("hi from gist.github.com/dcts");
// HELPER FUNCTIONS
function setLoading(bool) {
const bttn = document.querySelector(".experimentalEngeduGtiProjectsWeek20230206EmeaTeam03JavaComGoogleBoqCodetransUiHomeHomeViewTranslateBttn_");
const bttnText = document.querySelector(".experimentalEngeduGtiProjectsWeek20230206EmeaTeam03JavaComGoogleBoqCodetransUiHomeHomeViewTranslateBttnText_");
const bttnTextSpanLoader = document.querySelector(".experimentalEngeduGtiProjectsWeek20230206EmeaTeam03JavaComGoogleBoqCodetransUiHomeHomeViewTranslateBttnTextSpanLoader_");
if (bool) { // set loading state
bttn.classList.add("isLoading_");
bttnText.classList.add("isLoading_");
bttnTextSpanLoader.classList.add("isLoading_");
} else { // unset loading state
@dcts
dcts / gist:940fbd0c23d6ffd1de621707ec041fdf
Created October 6, 2023 12:59 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@dcts
dcts / gist:432a6cbada6ca2a153edac435e6327f7
Created October 26, 2023 12:26 — forked from collinprice/gist:9541470
Base64 encoded audio file.
var sound = new Audio("data:audio/wav;base64,UklGRuy3AABXQVZFZm10IBAAAAABAAEAIlYAACJWAAABAAgAZGF0Yci3AACIhISCgH5+enx+gHx4cm5udHp+fHh0cHJ0enx8enx+fn6GiIyMiIaKio6Wmp6goJycnp6coJ6cnJqanqSoqqigmJKSmJygop6ampycmpaOjIiIhoSChoiGgHx2cG5qaGhiYmRkZmRgXFpUUlJUVlhcVlZYWmBgYFxaWlxiZmpsbGxsampubnBwbmxsbnB0cHBubGpqbGxwcnRwbnB2enyAfoB8fH5+goSEhISCgICEhoyKhoCChIiMjIyKiIaCgoaMioiEhISGjpaanJyYlpSWnqKkoJyYlpiYmJaSkI6MioSKjIyIhIB8en5+fHp2eHp6fn6AfHp8enh8foSEgoJ+foKGiIaAeHR2dn58fHx8fHZ2cnBydnRwcHJ6fHp2dHBwbm5sbm5wcHJubnB0dHBwbG50dnx8enp4enZ2dnZ0dnh4fH5+fHp2dHR0enZ0cnZ6eHp6eHh0dnh0dHZ2eHZ0cGxqamZiXFpYWFhaWlhYVlhYVlZaWl5gYGJkZmhoaGxucHJ0eHR2en58fHh0dnZ8foCAgH6ChoSEhISEhoaIjJKWmpiSkpSWmp6enJiampqcnpqYkI6MjIyOjIiGhoiIhoqIiISChISKjo6MiISEhoqOkJKSkpSQjpKYmpqWkJCOkpKUkpKQio6OjI6MhoKAenp2dHJuamhoZGRoamhmZmZkZmhqamhoaGxsbm5qamZoaGpqbm5ubmxuamxsbm50cnR2fHx+foSAfn6CiIqMjpKSkpaeoqCWlJSWlpSanp6alJSSkJCSlpaSkpKWmqCemJKOjI6SlpaYnJqUlJaYlpKQkJCSlpqYkI6OjoyKiIiEgHx+hoaIhoJ8dHBucnR0cHJycHJucGpoZmZoZGZoaG5ubmpsamhkZGRkZGZqbGhmZmhkZGZkYmJkZGZqbG5wcGh
@dcts
dcts / gist:e92ad3302be703707592761426854dec
Created April 12, 2024 17:52
getTokenInfos.ts for DeXter
// Helper function to download data
function downloadObjectAsJson(exportObj: any, exportName: string) {
var dataStr =
"data:text/json;charset=utf-8," +
encodeURIComponent(JSON.stringify(exportObj, null, 2));
var downloadAnchorNode = document.createElement("a");
downloadAnchorNode.setAttribute("href", dataStr);
downloadAnchorNode.setAttribute("download", exportName + ".json");
document.body.appendChild(downloadAnchorNode); // required for firefox
downloadAnchorNode.click();
// Helper function to download data
function downloadObjectAsJson(exportObj: any, exportName: string) {
var dataStr =
"data:text/json;charset=utf-8," +
encodeURIComponent(JSON.stringify(exportObj, null, 2));
var downloadAnchorNode = document.createElement("a");
downloadAnchorNode.setAttribute("href", dataStr);
downloadAnchorNode.setAttribute("download", exportName + ".json");
document.body.appendChild(downloadAnchorNode); // required for firefox
downloadAnchorNode.click();