Skip to content

Instantly share code, notes, and snippets.

View cmbaughman's full-sized avatar
🎯
Focusing

Chris Baughman cmbaughman

🎯
Focusing
View GitHub Profile
@cmbaughman
cmbaughman / useful.js
Created October 21, 2025 18:29
Useful Javascript Tips
/////////////////////////////////////////////////////////
// Debounce: wait until the user stops typing
function debounce(fn, delay) {
let timeout;
return (...args) => {
clearTimeout(timeout);
timeout = setTimeout(() => fn.apply(this, args), delay);
};
}
@cmbaughman
cmbaughman / kas.css
Last active October 21, 2025 18:05
Kick-ass style patterns to include in every project
/* Recommended font stack for neutral, modern look */
:root { --ui-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; }
body { font-family: var(--ui-font); }
/* Self-hosted font (or just comment out) */
@font-face{
font-family: 'YourCoolFont';
src: url('/fonts/yourcool.woff2') format('woff2');
font-display: swap;
@cmbaughman
cmbaughman / cloud-config.yaml
Created October 16, 2025 13:14
Cloud Init Script To Install Docker
#cloud-config
package_update: true
package_upgrade: true
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
@cmbaughman
cmbaughman / CSSFix.css
Created September 10, 2025 13:22
CSS to include in all websites for smoother scrolling and GPU acceleration for all transforms
html {
scroll-behavior: smooth;
}
.section {
transform: translateZ(0); /* force GPU layer */
will-change: transform;
}
@cmbaughman
cmbaughman / performance_cte.md
Created August 19, 2025 13:51
Fixing SQL Query Performance With CTEs

Fixing SQL Query Performance With CTEs

Original query. Execution time: 127 seconds. +150 million rows.

SELECT
    c.customer_id,
    c.segment,
    SUM(t.amount) AS total_spent
FROM customers c
@cmbaughman
cmbaughman / minimalistcool_css_stuff.md
Created June 13, 2025 14:08
Minimalist CSS Only Stuff

Cool CSS Only Stuff

CSS Only Modals

<a href="#modal">Open Modal</a>

<div id="modal" class="modal">
  <a href="#" class="close">×</a>
  <p>This is a CSS-only modal window!</p>
@cmbaughman
cmbaughman / useful.js
Created June 11, 2025 13:27
Cool Javascripts to reuse
// Download file
export function downloadFile(url, filename) {
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
// Example: downloadFile("/resume.pdf", "MyResume.pdf");
@cmbaughman
cmbaughman / move.bat
Created March 14, 2025 13:32
Simple bat file calling powershell to move the mouse every 5 minutes.
@echo off
setlocal
:loop
powershell -command "[void][System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point((Get-Random -Minimum 0 -Maximum 1920), (Get-Random -Minimum 0 -Maximum 1080))"
timeout /t 300 /nobreak >nul
goto loop
endlocal
@cmbaughman
cmbaughman / wild.js
Created February 6, 2025 18:26
Wild Javascript APIs
// Get connection speed
if (navigator.connection) {
const downlink = navigator.connection.downlink;
console.log(`Current download speed: ${downlink} Mbps`);
}
else {
console.log("Network Information API not supported");
}
// Mobile device vibrate
@cmbaughman
cmbaughman / .editorconfig
Created May 29, 2024 19:14
Editor Config
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single
### Frontend files