Skip to content

Instantly share code, notes, and snippets.

Avatar
👮‍♂️
git inspector

Andrew Luca iamandrewluca

👮‍♂️
git inspector
View GitHub Profile
@iamandrewluca
iamandrewluca / github-tab-size.js
Last active Sep 19, 2020
🔥🔥🔥 Change GitHub Tab Size #bookmarklet
View github-tab-size.js
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
if (window.location.origin !== 'https://github.com') return;
const tabSizeInput = window.prompt("Write indent size", '4');
if (/^\d+$/.test(tabSizeInput)) {
const newUrl = new URL(window.location.href);
newUrl.searchParams.set('ts', tabSizeInput);
@iamandrewluca
iamandrewluca / template.js
Created Sep 19, 2020
Template bookmarklet #bookmarklet
View template.js
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
/* code goes here */
})());
View App.tsx
import * as React from "react";
import "./styles.css";
import { useCountState, useCountDispatch } from "./count-context";
export default function App() {
const count = useCountState();
const dispatch = useCountDispatch();
return (
<div className="App">
{count}
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 Sep 19, 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. Starter template

  • [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);
You can’t perform that action at this time.