Skip to content

Instantly share code, notes, and snippets.

👮‍♂️
git inspector

Andrew Luca iamandrewluca

👮‍♂️
git inspector
View GitHub Profile
@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 / 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 / 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 / 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 / Accordion.jsx
Last active Jun 19, 2020
Reactstrap Uncontrolled Accordion
View Accordion.jsx
import React from 'react'
import { Card, CardBody, CardHeader, Collapse, Button } from 'reactstrap'
import PropTypes from 'prop-types'
export class Accordion extends React.Component {
state = {
open: this.props.open,
}
toggleSection = (index) => () => {
@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 / 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 Jun 18, 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 = [
"(╯°□°)╯︵ ┻━┻",
"(┛◉Д◉)┛彡┻━┻",
"(ノ≧∇≦)ノ ミ ┸━┸",
"(ノಠ益ಠ)ノ彡┻━┻",
"(╯ರ ~ ರ)╯︵ ┻━┻",
"(┛ಸ_ಸ)┛彡┻━┻",
"(ノ´・ω・)ノ ミ ┸━┸",
@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 / request-picture-in-picture.js
Last active Jun 18, 2020
Request picture in picture on first found video that is playing #bookmarklet
View request-picture-in-picture.js
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
/** @type {NodeListOf<HTMLIFrameElement>} */
const iFrames = window.document.querySelectorAll('iframe');
/** @type {Document[]} */
const allDocuments = [
window.document,
...Array.from(iFrames)
.map(i => i.contentDocument)
You can’t perform that action at this time.