John Cox

Blogs · @wyome

Tagged tutorial · everything

Mousetrap - Keyboard shortcuts in Javascript

Mousetrap is a lightweight JavaScript library (2kb minified and gzipped) for binding keyboard shortcuts to callbacks, supporting single keys, key combinations, and key sequences inspired by Gmail. It handles cross-browser compatibility and provides methods to bind, unbind, and trigger keyboard events, with built-in protection against firing shortcuts inside form fields unless explicitly enabled. The library also supports extensions for features like global bindings, pause/unpause functionality, and custom shortcut recording.

Permalink

10 Tips for Optimizing MySQL Queries (That don't suck)

This critique argues that Justin Silverton's list of MySQL optimization tips fails because it focuses on micro-level tweaks (like removing parentheses) instead of the foundational work that produces real performance gains. The author contends that 95% of optimization comes from benchmarking, profiling, understanding SQL fundamentals, designing proper schemas, and choosing appropriate indices—while only the final 5% involves database-specific tricks like the SQL_SMALL_RESULT hint that Silverton emphasizes. The piece then presents the author's own prioritized approach to MySQL optimization, starting with profiling tools and the slow query log, then moving through schema design, table partitioning, index strategy, and understanding MySQL's storage engines.

Permalink

jeresig/jquery.hotkeys · GitHub

jQuery Hotkeys is a plugin that simplifies binding keyboard event handlers to specific key combinations using a streamlined syntax like `$(document).bind('keydown', 'ctrl+a', fn)`. The plugin intelligently avoids conflicts by not tracking hotkeys when users are typing in input fields unless explicitly bound to those elements, and it supports modifier keys, namespacing, and works across jQuery 1.4.2+ and all major browsers with some caveats around meta/hyper keys and browser-specific behavior with built-in shortcuts.

Permalink

10 essential performance tips for MySQL | ITworld

California and at least 44 other US states are blocking or delaying a projected $68 billion in data center projects as communities resist the massive demands these facilities place on power grids, water supplies, and land. The surge in opposition reflects growing tension between AI infrastructure expansion and regional resource constraints, forcing tech enterprises to reconsider their deployment strategies.

Permalink

Top Shadow | CSS-Tricks

I can't summarize this content as requested. This appears to be a comment thread discussing CSS techniques for creating fixed-position drop shadows on web pages, rather than a saved article. The conversation covers implementation details, browser compatibility issues, and variations of the shadow effect, but there's no coherent article with a single argument or report to summarize.

Permalink

QueryLoader2 – Preload your images with ease - Gaya Design

QueryLoader2 is an updated jQuery plugin that preloads all images (including background images) from specified page elements before the website becomes visible to users. The tool has been simplified for easier implementation and works across modern browsers and IE7+ by automatically scanning for images and displaying a customizable loading bar with options for percentage display, animation type, and callback functions. The code is maintained on GitHub, allowing users to report issues and contribute fixes.

Permalink

Reference - What does this symbol mean in PHP? - Stack Overflow

PHP's splat operator (...), available since version 5.6, allows functions to accept an arbitrary number of arguments and arrays to be unpacked into function parameters. When used in function definitions, it collects multiple arguments into an array; when used in function calls, it unpacks arrays or associative arrays into individual arguments or named parameters. The operator can also be used multiple times in a single function call and works with type declarations, though variadic parameters cannot themselves be targeted by named arguments—only their individual values when unpacked from associative arrays.

Permalink

What makes a good MySQL index? Part 2: Cardinality « James Cohen

This article explains how cardinality—the uniqueness of values in an indexed column—affects MySQL query performance, using a sample user table to demonstrate why indexes with higher cardinality are generally more selective and efficient. It shows that MySQL's query optimizer strategically chooses whether to use an index based on whether it will actually reduce the number of rows to scan, sometimes opting for a full table scan when an index would be inefficient. The article also notes that low cardinality isn't inherently problematic if the data distribution is skewed enough that queries still filter down to a small subset of rows.

Permalink

Slow Queries? Check the Cardinality of Your MySQL Indexes | Lullabot

The article demonstrates how adding unnecessary indexes can actually harm database performance rather than improve it. The author discovered that the User Relationships module included an index on the `rtid` (relationship type) column despite it having extremely low cardinality—only one distinct value across 219,406 rows—which caused the database optimizer to choose an inefficient query path. By removing the low-cardinality index and restructuring the primary key, the author reduced query execution time from nearly one second to about 8 milliseconds, illustrating that indexes should be designed based on actual data distribution and cardinality, not just guessed at.

Permalink

How to: Use MySQL fast LOAD DATA for UPDATEs - SoftwareProjects : Internet Marketing Services

This is not a saved article but rather a company website for SoftwareProjects, a platform established in 2003 that provides eCommerce and digital business solutions. The site describes their evolution from a web development agency to a SaaS vendor offering tools like CRM, shopping carts, email marketing, and analytics, with particular focus since 2015 on eCommerce shopping cart functionality. Their pitch emphasizes curated product quality, continuous monitoring of user feedback, 24/7 support across 17 countries, and features like real-time analytics, anti-fraud protection, and affiliate management.

Permalink

Table rows as clickable anchors – James Padolsey

The author explains why naive solutions for making table rows clickable (using JavaScript to redirect on click) are problematic—they lack browser features like middle-click-to-open-in-new-tab and right-click context menus that users expect from real links. Rather than attempting to simulate all this missing functionality, the author created a jQuery plugin that overlays an actual anchor element across clickable rows, preserving all native link behaviors while maintaining the appearance and user experience of a large clickable area.

Permalink

The Shapes of CSS

This article catalogs CSS techniques for creating various geometric and complex shapes using only HTML elements and CSS properties like border-radius, pseudo-elements (::before and ::after), positioning, and transforms. It demonstrates how to build everything from basic shapes like circles and triangles to more elaborate designs like stars, pentagons, pac-man, speech bubbles, and locks—showing the creative workarounds developers used before modern CSS shape tools became available. The piece is now somewhat dated given the evolution of CSS shape properties, but served as a comprehensive reference for CSS-only shape creation in 2018.

Permalink

Showing Product Information With CSS3 3D Transform – Webstuffshare – Learn and share. The simplest harmony.

This is a broad instructional overview of web development fundamentals covering HTML structure, responsive design principles, database management, and the full-stack toolset needed to build modern websites. It emphasizes practical advice for beginners and intermediate developers, including practical steps like choosing domain names and hosting providers, and explains core concepts like how HTML tags create page structure and how fluid grids enable mobile-responsive layouts. The guide positions itself as an evolving resource that adapts to the changing web landscape and different skill levels.

Permalink

HTML for Icon Font Usage | CSS-Tricks

This article explores best practices for implementing icon fonts in HTML while maintaining accessibility and semantic quality. The author recommends combining a data attribute with a `<span>` element and `aria-hidden="true"` to add decorative icons alongside text, avoiding VoiceOver announcement issues that arise from pseudo-elements alone; for standalone functional icons like shopping carts, the same technique pairs the icon with off-screen screen-reader text. The piece emphasizes mapping icon fonts to meaningful Unicode symbols or the Private Use Area rather than arbitrary letters, and recommends tools like IcoMoon for custom font generation that avoids confusing screen reader output.

Permalink

Item Blur Effect with CSS3 and jQuery | Codrops

This tutorial demonstrates how to create an interactive focus effect on text cards using CSS3 transitions and jQuery, where hovering over one card scales it up and blurs its neighboring cards. The effect uses CSS transforms, box-shadows, and text-shadow properties to create the blur illusion, with JavaScript simply toggling "active" and "blur" classes on hover to trigger the smooth transitions. The technique relies on modern browser support for CSS3 transitions and works best in Chrome and Safari.

Permalink