Tell us what works and what could be better. We read every submission.
@anatolyg·11 public vizzes
This interactive map visualizes average HCC risk scores across U.S. counties, using Medicare physician utilization data from 2013. Counties are colored with a YlGn sequential color scale from ColorBrewer, encoding the aggregated risk scores. The application leverages a modern GIS stack—PostGIS with TIGER census geographies—to join zip-level HCC scores to counties via spatial queries, then exports the aggregated results as GeoJSON/TopoJSON for rendering in the browser. Built with D3.js, the visualization supports smooth panning and zooming over an SVG map of the United States, with county boundaries and a color legend, enabling users to explore regional variations in HCC risk scores. The project demonstrates how to combine PostGIS spatial data processing with D3's data-driven capabilities to create an interactive web GIS application.
A rectangle centered in an SVG canvas animates its fill color from dark red to light blue over three seconds, demonstrating a simple transition with a bounce easing. The example uses D3.js version 3.5.5, applying a `transition().duration(3000).ease("bounce")` to a `rect` element with explicit `x`, `y`, `width`, and `height` attributes. The SVG is sized to 960 by 500 pixels with margins, and the code runs directly in the browser, logging a confirmation message to the console. No external data source is involved; the visualization relies solely on hardcoded geometry and styling.
This example visualizes a user’s identity verification on the Bitcoin username service Openname. It shows the author’s profile name and its association with a Bitcoin address, confirming the link through the onename.io API. The code uses d3.forceSimulation to position and animate the profile and address nodes, with d3.geoPath drawing a map background. It retrieves the data via a remote request and renders the result on an HTML canvas.
This example shows how to set up a local Elasticsearch test instance in a Vagrant virtual machine, complete with a suite of management plugins. The Vagrantfile provisions a precise64 Ubuntu VM with 512 MB of memory and a private network IP, while the es.sh script installs Elasticsearch 1.1.0 via its Debian package and then loads plugins like elasticsearch-head, elasticsearch-HQ, and bigdesk for cluster monitoring. It also demonstrates adding a JDBC river plugin with a PostgreSQL driver to enable database indexing, then starts the service and verifies it via a curl request.
This example demonstrates the setup of an Elasticsearch server with a suite of management and monitoring plugins. The shell script installs OpenJDK 7, downloads Elasticsearch 1.1.0 as a Debian package, and configures plugins including elasticsearch-head, elasticsearch-gui, inquisitor, browser, HQ, suggest, MongoDB river, JDBC river, and bigdesk. It also downloads the PostgreSQL JDBC driver and moves it into the river-jdbc plugin directory. The process concludes by starting the Elasticsearch service, making the server available at localhost:9200.
This example presents a minimal single-column email template designed to render reliably across desktop and mobile email clients. It shows a responsive layout where the content area stretches to full width on smaller screens while remaining capped at 540 pixels on wider devices. The implementation uses an HTML table structure with inline styles and a CSS media query targeting min-device-width. Conditional comments for Microsoft Outlook and Internet Explorer wrap the table to enforce a fixed width, and the placeholder "[PUT EMAIL CONTENT HERE]" indicates where the actual email body would be inserted.
This example visualizes a common Java memory error, `java.lang.OutOfMemoryError: PermGen space`, and presents a fix through a configuration snippet. It shows a terminal-style window with the error message and the `.sbtconfig` file content that sets `SBT_OPTS` with `-XX:MaxPermSize=512M` and related JVM flags. The visualization uses a monospace font and a dark background to mimic a text editor, rendering the code as plain text without any graphical charts. The data source is a gist by author anatolyg, and the rendering approach relies on static text display, with no interactive or dynamic elements.
This code example shows the implementation of a MongoDB data access layer in Scala using the ReactiveMongo and Play Framework libraries. It is organized into three traits and objects: `BaseDAO` defines common error handling logic via a `Recover` method that maps database operation results to either service exceptions or success values, handling specific database error codes like duplicate keys (11000); `DBQueryBuilder` provides utility methods for constructing MongoDB query operators such as `$set`, `$push`, `$pull`, and `$unset`; and `DocumentDAO` implements CRUD operations with automatic timestamps and ID generation for temporal models. The visualization demonstrates how error handling, query building, and data access patterns are structured in a Scala/Play application using ReactiveMongo.
This example demonstrates a shell-script configuration that ensures a persistent terminal session automatically loads whenever a user starts a new login shell. It shows a conditional check on the `$TERM` environment variable to detect whether the session is already running inside GNU Screen, a terminal multiplexer. If not, the script invokes the `screen` command with the `-xRR` flags, which reattaches to an existing session or creates a new one while detaching other connections. The code resides in the user’s `.bashrc` file, relying on standard Bash conditional logic and the Screen application’s command-line interface.
This example visualizes a Zsh prompt configuration that dynamically displays git repository status. The prompt shows the current user, machine, path, and a colored ball indicating branch state: red for uncommitted changes, yellow for committed-but-unpushed commits, and green for up-to-date branches. It uses the `vcs_info` Zsh module with `zstyle` hooks to detect staged and unstaged files, while the `precmd` function checks for untracked files using `git ls-files`. The `PROMPT` variable assembles the final output with ANSI color codes, and the oh-my-zsh framework loads plugins like `git`, `osx`, and `brew`.
This example shows a complete Express authentication system that uses Redis as a session store and CouchDB as the user database, with CoffeeScript as the implementation language. The code demonstrates session management with `req.session.regenerate()` and `req.session.destroy()`, password hashing via `hash.sha1`, and CSRF protection through the `csrf.check()` middleware. Routes for login, signup, dashboard, and logout interact with the CouchDB client through `db.getDoc` and `db.saveDoc`, while the fugue library handles multi-process server startup.