Skip to content

Instantly share code, notes, and snippets.

View Explosion-Scratch's full-sized avatar

--Explosion-- Explosion-Scratch

View GitHub Profile

Copy ChatGPT Transcript as markdown

javascript:void (async () => { let { default: TD } = await import("https://cdn.skypack.dev/turndown");  let json = [   ...document.querySelectorAll(".text-base"), ].map((i) => ({   html: i.innerHTML,   text: i.innerText,   markdown: new TD().turndown(i),   isPrompt: !i.querySelector(".prose"), }));  window.open(   URL.createObjectURL(     new Blob(       [         json           .map((i) =>             i.isPrompt ? `**Prompt**: ${i.text}` : `**ChatGPT**: ${i.markdown}`           )           .join("\n\n"),       ],       { type: "text/plain" }     )   ) ); })()

Google answer

Get a quick answer from google for any question

(async function answer(q) {
  var html = await fetch(
    `https://cors.explosionscratc.repl.co/google.com/search?q=${encodeURI(q)}`,
@Explosion-Scratch
Explosion-Scratch / Useful stuff.md
Last active April 11, 2024 19:13
Useful stuff

Useful resources

Here you will find lots of useful resources to me as a developer, everything from font pairing, to regex finding, to tailwind resources is here! If you have any suggestions feel free to suggest them in a comment!

Fonts

@Explosion-Scratch
Explosion-Scratch / Quizlet flashcards.js
Created October 12, 2021 23:55
Get Quizlet flashcards via API
async function quizlet(id){
let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=1`).then(res => res.json())
let currentLength = 5;
let token = res.responses[0].paging.token
let terms = res.responses[0].models.studiableItem;
let page = 2;
console.log({token, terms})
while (currentLength >= 5){
let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=${page++}&pagingToken=${token}`).then(res => res.json());
terms.push(...res.responses[0].models.studiableItem);
@font-face {
font-family: 'Product Sans';
src: url('data:application/octet-stream;base64,d09GMgABAAAAADREAA8AAAAApUQAADPjAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGjwb9DYcjxoGYACDWhEQCoGiNP9lC4Q6AAE2AiQDiHAEIAWFdAeIfRuxkDXjmKV4HACcLfHIQG5HpCLE8yMRwsZBxoY9zf7/rwl0jOGpAaJZGYIgVFYmWM60pMNiAJZldgli2bayMuxhyKPbgVyWCkOAxPHqqV78H+5GbcO/zzlj5JYbXe51wVER4z9y3+lvQxW32bUe0WV5xqVLgsYfjjm0OJ0hfo3k+jOwbeRPcvLyPO/Yl/clf2YZQQKA0FRANrrVJPdUAsnKaQ7IzRp00020g2Ah2LEhIKCglIW+KEgRcFUsFUvHGk03rZlmajG1m1yMid4nd5d0k9zlamq98uBkjMGfZpU6kM1iJk7UvSp4ejjZu/trkwSixTBIEvAfAQXw3+AHn1UD4CinOWM4mJGKxHFod0e20jo5X6JcVWJ/pK/0LVB6xQBwiQMC/597d3915TXWPN6JFwaUTYrjPUADziSza+JJ7M8wHpfLlZfIJPISeYlMIpWTyknlpP87Z9sRCzlhlv4AXdQx2iJkLyVE5ZZlgHe7SeffptrxzhDgqwpuJvvl3QvwsBVo6rIAv/3r/5NP/77PIFkRheW86IxnOWAFrVOcd5KjAMoBRilhwwsQT8WxPALB3NcJ9w5btxWHrcM6tH457aUppQzPhPBeGfDtW9+O5bNTC2sF0C+tJft6WuVBJBiH4QBmJR0Gx//a79Xm5rwTpM1MJKAzG+c+0MuG+AaQCgjCtOPr6+qRXWVdjanz9WW9ri9htE4gYrqQjyniunrWr71q8xaV5KpSOY/aMRyHdxCWN6TVL5NSd8Oq1UK7e3fzlqH3iwyliAQJIUgIQbLPMTaLCrfGKfT
// ==UserScript==
// @name Auto Picture-in-Picture
// @namespace mailto:explosionscratch@gmail.com
// @version 0.1
// @description Auto picture in picture for YouTube
// @author Explosion-Scratch
// @match *://youtube.*/*
// @grant none
// ==/UserScript==
@Explosion-Scratch
Explosion-Scratch / Compress string.js
Created November 1, 2021 18:51
Compress string using gzip and native browser APIs
function compress(string, encoding) {
const byteArray = new TextEncoder().encode(string);
const cs = new CompressionStream(encoding);
const writer = cs.writable.getWriter();
writer.write(byteArray);
writer.close();
return new Response(cs.readable).arrayBuffer();
}
function decompress(byteArray, encoding) {
@Explosion-Scratch
Explosion-Scratch / ChatGPT Auto Send.md
Last active February 19, 2024 11:23
Use ChatGPT as a custom search engine in Chrome - ChatGPT Auto Send

ChatGPT Auto Send

chatgpt_search_demo.mp4

Allows using ChatGPT as a search engine or to summarize transcripts (https://chat.openai.com/?query=%s, e.g. https://chat.openai.com/?query=how large is the sun).

You can also use it with Claude, for example https://claude.ai/chats?query=hello.

There's also ?transcript and ?copied. copied uses the prompt from your clipboard (you might have to click "Allow" on the notif asking permission), and transcript hides miscellaneous UI elements and writes an article based on a video transcript instead of using the default prompt.

@Explosion-Scratch
Explosion-Scratch / Bard Copy Button.user.js
Last active December 18, 2023 16:17
Add a copy button to bard's responses
// ==UserScript==
// @name Bard copy button
// @namespace mailto:explosionscratch@gmail.com
// @version 0.1
// @description Add a copy button to Google Bard's response without clicking more
// @author Explosion-Scratch
// @match https://bard.google.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bard.google.com
// @grant none
// ==/UserScript==
@Explosion-Scratch
Explosion-Scratch / bard.js
Created May 2, 2023 13:46
Bard Client for use in Userscripts/Extensions
class BardBot {
/**
* The conversation context.
* @type {Object}
*/
conversationContext = undefined
/**
* The logging function.
* @type {Function}
*/
// ==UserScript==
// @name Bard
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=textarea.online
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// ==/UserScript==