Skip to content

Instantly share code, notes, and snippets.

👮‍♂️
git inspector

Andrew Luca iamandrewluca

👮‍♂️
git inspector
View GitHub Profile
View remove-liked-videos.js
const sleep = time => new Promise(resolve => setTimeout(resolve, time))
let items = []
const interval = setInterval(async function() {
if (items.length < 10) {
items = Array.from(document.querySelectorAll('#contents ytd-playlist-video-renderer:not([is-dismissed])'))
}
if (items.length === 0) {
clearInterval(interval)
return
}
View tailwindcss-service.js
const postcss = require("postcss");
const tailwind = require("tailwindcss");
const express = require("express");
const app = express();
app.get("/:configBase64/tailwind.css", async (req, res) => {
const buffer = Buffer.from(req.params.configBase64, "base64");
const config = JSON.parse(buffer.toString("utf-8"));
const baseCSS = `@tailwind base;@tailwind components;@tailwind utilities;`;
@iamandrewluca
iamandrewluca / find-duplicated-ids.js
Created Jun 29, 2020
Will search and mark duplicated IDs on a page #bookmarklet
View find-duplicated-ids.js
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
document.querySelectorAll('[id]').forEach(el => {
const specificIds = document.querySelectorAll(`[id="${el.id}"]`);
if (specificIds.length > 1 && specificIds[0] === el) {
console.log('Duplicate id ' + el.id);
specificIds.forEach(element => {
element.style.outline = '5px solid red';
});
alert('duplicate found');
@iamandrewluca
iamandrewluca / edit-website.js
Created Jun 29, 2020
Enable page editing #bookmarklet
View edit-website.js
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
document.body.contentEditable = 'true';
document.designMode='on';
})());
@iamandrewluca
iamandrewluca / headings-out-of-order.js
Last active Jun 29, 2020
Will outline headings out of order in a page (from https://twitter.com/Una/status/1277652897606635523) #bookmarklet
View headings-out-of-order.js
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
const styles = document.createTextNode(`
/* Headers out of order (i.e. h2 before h1, etc.) */
/* Result: dotted blue outline */
/* https://twitter.com/Una/status/1277652897606635523 */
h2 ~ h1,
h3 ~ h1,
h4 ~ h1,
h5 ~ h1,
@iamandrewluca
iamandrewluca / bookmarklets.md
Last active Jun 30, 2020
Collection of bookmarklets that I use day to day #bookmarklets
View bookmarklets.md

Any other ideas are welcome. Just ask if what you want is possible.

  • [Generate a password in browser][1]
  • [Toggle password inputs to text back and forth][2]
  • [Request picture in picture on first found video that is playing][3]
  • [Open any URL with host as localhost:3000][4]
  • [Random table flip text emoji][5]
  • [Random Shrug text emoji][6]
  • [Will speak any select text from page][7]
  • [Outline headings out of order in a page][8]
@iamandrewluca
iamandrewluca / speak-selected-text.js
Last active Jun 18, 2020
Will speak any select text from page #bookmarklet
View speak-selected-text.js
javascript: void ((async () => {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
let interval = 500;
const intervalId = setInterval(() => {
interval += 500;
if (interval > 5000) { return; }
if (window.speechSynthesis.getVoices().length !== 0) {
clearInterval(intervalId);
@iamandrewluca
iamandrewluca / open-localhost.js
Last active Jun 18, 2020
Open any URL with host as localhost:3000 #bookmarklet
View open-localhost.js
javascript: void((function () {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
/**
* Add your own mappers, first found will be used
* @type {{host: string, startsWith: string}[]}
*/
const hostMapper = [
{ startsWith: 'https://example.org', host: 'localhost:3000' },
{ startsWith: 'https://example.org/admin', host: 'localhost:3001' },
];
@iamandrewluca
iamandrewluca / shrug.js
Last active Jun 18, 2020
Random Shrug text emoji #bookmarklet
View shrug.js
javascript: void(function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
const all = [
"¯\\_(ツ)_/¯",
"¯\\(ツ)/¯",
"ʅ(ツ)ʃ",
"乁(ツ)ㄏ",
"乁(ツ)∫",
"ƪ(ツ)∫",
"¯\\_₍ッ₎_/¯",
@iamandrewluca
iamandrewluca / table-flip.js
Last active Jul 27, 2020
Random table flip text emoji #bookmarklet
View table-flip.js
javascript: void(function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
const all = [
"(╯°□°)╯︵ ┻━┻",
"(┛◉Д◉)┛彡┻━┻",
"(ノ≧∇≦)ノ ミ ┸━┸",
"(ノಠ益ಠ)ノ彡┻━┻",
"(╯ರ ~ ರ)╯︵ ┻━┻",
"(┛ಸ_ಸ)┛彡┻━┻",
"(ノ´・ω・)ノ ミ ┸━┸",
You can’t perform that action at this time.