// Structured logging with Winston (Node.js)
const winston = require('winston');
const { v4: uuidv4 } = require('uuid');
// Create logger
const logger = winston.createLogger({
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["checkbox", "selectAll", "count", "submit"]
static values = { selectedIds: Array }
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["input", "counter"]
static values = {
max: { type: Number, default: 280 }
import { useCallback, useEffect, useRef } from 'react';
export function useRafThrottle(callback) {
const savedCallback = useRef(callback);
const frame = useRef(null);
const latestArgs = useRef([]);
const { Pool } = require('pg');
const Cursor = require('pg-cursor');
const pool = new Pool();
async function* streamUsers({ since, batchSize = 500 }) {
const Busboy = require('busboy');
const { storeFile } = require('./storage');
function parseMultipart(req, { maxFileSize = 20 * 1024 * 1024 } = {}) {
return new Promise((resolve, reject) => {
const busboy = Busboy({
<div class="search-page">
<div class="search-header mb-6">
<h1 class="text-2xl font-bold mb-4">Search Posts</h1>
<%= form_with url: posts_path,
method: :get,
class SignupsController < ApplicationController
def new
@user = User.new
end
def create
const sharp = require('sharp');
const DEFAULTS = {
maxWidth: 1600,
maxHeight: 1600,
format: 'webp',
class Comment < ApplicationRecord
belongs_to :commentable, polymorphic: true
belongs_to :author, class_name: "User"
scope :visible, -> { where(deleted_at: nil).order(:created_at) }
// 1. Basic WebSocket connection
const socket = new WebSocket('wss://example.com/ws');
// Connection opened
socket.addEventListener('open', (event) => {
console.log('Connected to WebSocket server');
import { useCallback, useEffect, useRef } from "react";
export function useRafThrottle(callback) {
const callbackRef = useRef(callback);
const frameRef = useRef(null);
const latestArgs = useRef([]);