Skip to content

Instantly share code, notes, and snippets.

View timbryandev's full-sized avatar
🐝
Busy Bee'ing

Mothy timbryandev

🐝
Busy Bee'ing
View GitHub Profile
@timbryandev
timbryandev / # 🧼 Clean JIRA board view (Bookmarklet generation).md
Last active September 4, 2024 08:50
🧼 Clean JIRA board view (Bookmarklet generation)

What does it do?

Full-screen JIRA Kanban boards -like this: A screenshot of a JIIRA Kanban board with the blue header removed and no sidebars

Yeah, but what does it actually do?

Uses JS to inject toggle some CSS styles in the page that should hide a lot of noisy UI (personal opinion). What you are left with is a full-size Kanban board with minimal UI around it.

This bookmarklet will also work on other pages as I'm basically hiding everything outside of the <main> element and certain elements inside of it - simples!

Updates

@timbryandev
timbryandev / snippets.tsx
Created January 20, 2023 10:09
JS snippets
// replace all images with STARWARS
// document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('img').forEach(img => {
img.removeAttribute('srcset')
img.setAttribute(
'src',
'https://images.unsplash.com/photo-1651654325764-205a848bbea0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY1MzQ2NTA2Mg&ixlib=rb-1.2.1&q=80&w=1080'
)
})
@timbryandev
timbryandev / parent-ids-and-classes.md
Last active August 22, 2022 14:21
List all the classes and ids of all the parents of an element

Use your web browsers' dev tools elements pane and select the element you want to inspect.

Note You must perform this first step before following either of the below two options. This is because the main code uses the $0 browser varable which is assigned to the most receently selected DOM element through the elements tab in your web browser dev tools.

Option 1:

  • Paste this into your web browser console to log all parent element:
var element = $0
@timbryandev
timbryandev / DangerousHtml.jsx
Created August 11, 2022 13:59
Prevent XSS in React via dangerouslySetInnerHTML
/*
Exampmes:
// 1
const markup = `<p>Hola <img src='none.png' onerror='alert("Rainbow mode FTW!")'> Sharon</p>`
<DangerousHtml innerHTML={markup} /> // <p>Hola <img src='none.png'> Sharon</p>
// 2
<DangerousHtml

Implement Picture-In-Picture video feature on desktop for free, everywhere!

Some websites & video streaming services have a feature that allows you to watch videos in Picture-in-Picture mode, but they lock this feature behind some kind of paywall or make it a perk of having a subscription.

Some websites just don't have this feature altogether!

I find this infuriating, as this is a feature that is built into all modern web browsers and is free to use for those who know how to do it with no special effort, purchases, plugins or hack.

Here's how to do it:

@timbryandev
timbryandev / Linux list.md
Last active December 11, 2021 21:30
Handy Linux software that I want to keep between distro-hopping
@timbryandev
timbryandev / NVME SSD Freezing on Linux.md
Last active August 15, 2024 10:32
NVME SSD Freezing on Linux

Credit to the original poster: https://esc.sh/blog/nvme-ssd-and-linux-freezing/ Recording a copy here for personal use as I distro hop a lot and excitement with distros on a laptop that suffers from this issue.

nvme_core.default_ps_max_latency_us=5500

How to update the Kernel parameter

First of all, figure out if you are using Grub or systemd boot. If you are using Pop OS!, you are most probably using systemd-boot. I believe Ubuntu is still using Grub2, please do your research.

For Grub

@timbryandev
timbryandev / react-hooks.js
Created December 2, 2021 13:49
A collection of hooks I've found handy for use in React functional components
/**
*
* @param {function} effect
* @param {array} deps
* @param {number} delay
*/
export const useDebouncedEffect = (effect, deps = [], delay = 100) => {
useEffect(() => {
const handler = setTimeout(() => effect(), delay)
return () => clearTimeout(handler)