architecture

ruby
class ButtonComponent < ViewComponent::Base
  VARIANTS = {
    primary: "bg-blue-600 hover:bg-blue-700 text-white",
    secondary: "bg-gray-200 hover:bg-gray-300 text-gray-900",
    danger: "bg-red-600 hover:bg-red-700 text-white"
  }.freeze

ViewComponent for reusable UI components

rails viewcomponent components
by Jordan Lee 3 tabs
rust
use std::collections::HashMap;
use std::fmt;

#[derive(Debug, Clone)]
pub struct Document {
    pub body: String,

Trait-Based Document Transform Pipeline With Ordered Plugins in Rust

rust trait-objects pipeline
by codesnips 3 tabs
ruby
module Posts
  class CreateService
    def initialize(author:, params:)
      @author = author
      @params = params
    end

Rails service objects for business logic

rails architecture service-objects
by Maya Patel 2 tabs
sql
-- Pattern: Single Table Inheritance (STI)
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  type VARCHAR(50) NOT NULL, -- 'admin', 'customer', 'vendor'
  username VARCHAR(100) UNIQUE NOT NULL,
  email VARCHAR(100) UNIQUE NOT NULL,

Database design patterns and anti-patterns

database-design patterns anti-patterns
by Maria Garcia 2 tabs
css
/* BEM - Block Element Modifier */

/* BLOCK - Independent component */
.card {
  padding: 1rem;
  border: 1px solid #ddd;

CSS architecture patterns: BEM and utility-first approaches

css architecture bem
by Alex Chang 2 tabs
typescript
import { QueryResultRow } from 'pg';
import { pool, Queryable } from './db';

export abstract class BaseRepository<T extends QueryResultRow> {
  protected abstract readonly table: string;

Repository pattern for DB access (small, pragmatic)

node postgres architecture
by codesnips 4 tabs