Step-by-step guides for the work we actually do — Laravel, PHP, WordPress, MySQL, Linux servers, and the occasional rabbit hole. Every command has been run on a real machine; nothing is theoretical.
Run JavaScript when the URL hash changes by listening for the hashchange event on window. Includes initial-load handler, oldURL/newURL access,…
Redirect non-www to www or www to non-www in Nginx with a dedicated server block and return 301 $scheme://canonical$request_uri. Includes…
Prevent the Tab key from focusing on a specific tag by adding tabindex="-1". Keeps it mouse-clickable but skipped in keyboard…
Open the file-selection dialog when a button is clicked: use a for the hidden file input, or call input.click() from…
Make the first option selected in a with jQuery: $('#sel').prop('selectedIndex', 0). Includes Select2 variant and how to fire the change…
Make ApexCharts.js fill its parent's width with chart.width: '100%'. Includes the 300px-default fix, ResizeObserver for container resizes, and Bootstrap modal…
Load DataTables data via Ajax with $('#table').DataTable({ ajax: '...', columns: [{data: ...}] }). Includes JSON response shape, dataSrc, custom render…
Keep only the digits in a JavaScript string with str.replace(/\D/g, '') or /[^0-9]/g. Includes decimal-point, signed-number, and parseInt conversion variants.
Keep only the first N characters of a JavaScript string with str.slice(0, n) (or substring). Includes ellipsis-truncate, word-boundary, and emoji-safe…
Install Apache on Ubuntu: apt install apache2, allow it through UFW, verify with systemctl, and set up a virtual host.…
Sign in to your account