Examples

Page 50 of 50

Browse code examples

cssSnippet

Flexbox Layout Patterns

Demonstrates CSS Flexbox for one-dimensional layouts including centering, space distribution, wrapping, and responsive navigation patterns.

cssSnippet

CSS Grid Layout

Creates two-dimensional layouts with CSS Grid including template areas, responsive tracks, and auto-fit grids for complex page structures.

cssSnippet

CSS 2D and 3D Transforms

Uses CSS transform functions for 2D and 3D transformations including translate, rotate, scale, skew, and perspective for visual effects.

htmlSnippet

Article with Rich Content

Structures a blog article with semantic elements including header, time, figure, blockquote, and proper heading hierarchy for content rich pages.

htmlSnippet

Custom Elements API

Defines a custom HTML element with lifecycle callbacks, observed attributes, and Shadow DOM encapsulation for reusable component creation.

htmlSnippet

Accessible Data Table

Creates an accessible data table with proper scope attributes, captions, column groups, and responsive design for tabular data presentation.

htmlSnippet

Native Dialog Element

Uses the HTML dialog element to create modal and non-modal dialogs with built-in focus management, backdrop, and JavaScript API.

htmlSnippet

Ruby Text Annotations

Uses ruby, rt, and rp elements to add pronunciation guides and annotations above East Asian characters, with fallback support.

htmlSnippet

Section and Aside Layout

Creates a content layout using section and aside elements with proper heading hierarchy for main content and complementary sidebar information.

htmlSnippet

Semantic HTML Elements

Demonstrates semantic HTML5 elements for structuring content meaningfully, improving accessibility and SEO with proper document outline.

htmlSnippet

Time Element for Dates

Uses the time element with datetime attribute to represent dates and times in a machine-readable format for scheduling and display.

javaSnippet

Custom Exception Hierarchy

Defines a custom exception hierarchy with domain-specific exceptions, demonstrating proper exception chaining, message formatting, and multi-catch handling.

javaSnippet

Date and Time API

Uses the java.time API to work with dates, times, durations, periods, and formatting, demonstrating modern date-time manipulation and parsing.

javaSnippet

Scheduled Executor Service Tasks

Uses ScheduledExecutorService to run delayed and periodic tasks, demonstrating fixed-rate and fixed-delay scheduling with proper shutdown handling.

javaSnippet

File I/O with NIO

Demonstrates reading and writing files using Java NIO with Path, Files, and BufferedReader, including proper resource management and exception handling.

javaSnippet

Generic Class with Type Bounds

Implements a generic Box class with type bounds, demonstrating how generics provide compile-time type safety while working with constrained type parameters.

javaSnippet

JDBC Database Query

Demonstrates connecting to a database using JDBC, executing parameterized queries with PreparedStatement, and processing ResultSet with proper resource cleanup.

javaSnippet

Optional for Null Safety

Demonstrates using Optional to handle potentially absent values safely, with map, flatMap, filter, orElse, and ifPresent operations to avoid NullPointerExcep...

javaSnippet

Pattern Matching for Switch

Uses Java pattern matching with switch expressions and type patterns to handle different object types concisely without explicit casts or instanceof checks.

javaSnippet

Stream Collectors for Grouping

Demonstrates advanced Stream collectors including groupingBy, partitioningBy, counting, joining, and teeing for complex data aggregation and transformation.

javaSnippet

String Builder Manipulation

Demonstrates efficient string manipulation using StringBuilder for concatenation, insertion, deletion, and reversal operations in performance-critical code.

javaSnippet

Thread Pool with ExecutorService

Creates a fixed thread pool to execute multiple tasks concurrently, demonstrating proper resource management with try-with-resources and shutdown handling.

sqlSnippet

Index Creation StQuerygies

Creates various index types including B-tree, partial, expression, and composite indexes to optimize different query patterns and access paths.

sqlSnippet

Views for Data Abstraction

Creates simple and materialized views to abstract complex queries, pre-compute expensive aggregations, and provide simplified data access patterns.