Skip to content

Instantly share code, notes, and snippets.

View pirate-barbosa's full-sized avatar
🚀
Building stuffs

Sampath pirate-barbosa

🚀
Building stuffs
View GitHub Profile
@pirate-barbosa
pirate-barbosa / coverage.js
Created February 12, 2026 08:40 — forked from paulirish/coverage.js
JS coverage profiler data via protocol
'use strict';
const chromeLauncher = require('chrome-launcher');
const CDP = require('chrome-remote-interface');
const launchChrome = () =>
chromeLauncher.launch({
chromeFlags: ['--disable-gpu', '--headless']
});
@pirate-barbosa
pirate-barbosa / thing.js
Created February 12, 2026 08:39 — forked from paulirish/thing.js
log the clipboard contents
document.body.innerHTML = 'Paste or drop items onto this page. View results in console.';
function getPayload(item) {
const kind = item.kind;
switch (kind) {
case 'string': return new Promise(res => item.getAsString(res));
case 'file': return Promise.resolve(item.getAsFile());
default: throw new Error('unknown item kind! ' + kind);
}
@pirate-barbosa
pirate-barbosa / background-lh.js
Created February 12, 2026 06:52 — forked from paulirish/background-lh.js
run lighthouse headlessly
'use strict';
import fs from 'fs';
import puppeteer from 'puppeteer';
import {navigation} from 'lighthouse/lighthouse-core/fraggle-rock/api.js';
// Run Lighthouse headlessly, just Performance
(async function() {
const browser = await puppeteer.launch({headless: true});
@pirate-barbosa
pirate-barbosa / setup.sh
Created February 12, 2026 06:51 — forked from chris-sev/setup.sh
Mac Setup
# how to run this thingy
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
# heavily inspired by https://twitter.com/damcclean
# https://github.com/damcclean/dotfiles/blob/master/install.sh
# faster dock hiding/showing (run in terminal)
# defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
@pirate-barbosa
pirate-barbosa / conventional-commits.md
Created February 12, 2026 06:51 — forked from Zekfad/conventional-commits.md
Conventional Commits Cheatsheet

Quick examples

  • feat: new feature
  • fix(scope): bug in scope
  • feat!: breaking change / feat(scope)!: rework API
  • chore(deps): update dependencies

Commit types

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Changes which doesn't change source code or tests e.g. changes to the build process, auxiliary tools, libraries
@pirate-barbosa
pirate-barbosa / log-all-mutations.js
Created February 12, 2026 06:51 — forked from paulirish/log-all-mutations.js
Log all DOM mutations to console
// Log all DOM mutations to console.
// Modern interpretation of https://github.com/kdzwinel/DOMListenerExtension
observer = new MutationObserver(onMutation);
observerSettings = {
subtree: true,
childList: true,
attributes: true,
attributeOldValue: true,
@pirate-barbosa
pirate-barbosa / 0.README.md
Created February 12, 2026 06:50 — forked from intellectronica/0.README.md
⌘-Enter to Submit in AI Chats [MonkeyScript]

⌘-Enter to Submit in AI Chats

The cure for premature chat submission - never lose an incomplete prompt again!

Install this user script (using a monkey extension like TamperMonkey or similar) to patch the textbox in common AI chats (currently supports Claude, ChatGPT, Gemini, and Google AI mode) so that instead of using Enter to submit and Shift-Enter for new lines, they use ⌘-Enter to submit and Enter just adds a new line.


@pirate-barbosa
pirate-barbosa / what-forces-layout.md
Created May 28, 2025 13:47 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent