import { useState, useRef, useEffect, useCallback } from 'react';
export function useOnScreen(options = {}) {
const [node, setNode] = useState(null);
const [isIntersecting, setIsIntersecting] = useState(false);
export interface QueryCodec<T> {
parse: (raw: string | null) => T;
serialize: (value: T) => string | null;
}
export function stringParam(fallback = ""): QueryCodec<string> {
from datetime import date, datetime
from decimal import Decimal, InvalidOperation
from enum import Enum
from pydantic import BaseModel, field_validator
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AppConfig {
#[serde(default)]
pub server: ServerConfig,
class Cart < ApplicationRecord
has_many :cart_items, dependent: :destroy
EXPIRY_WINDOW = 2.hours
scope :active, -> { where(state: :active) }
@MappedSuperclass
@FilterDef(
name = "tenantFilter",
parameters = @ParamDef(name = "tenantId", type = String.class)
)
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
function createReadiness() {
let ready = true;
function markUnready() {
ready = false;
}
import type { Redis } from "ioredis";
export interface RawEntry {
member: string;
score: number;
}
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub struct Page<T> {
pub items: Vec<T>,
#[serde(default)]
module Middleware
class RateLimiter
def initialize(app, redis:, limit:, window:)
@app = app
@limiter = SlidingWindowLimiter.new(redis: redis, limit: limit, window: window)
@limit = limit
export const MAX_VISIBLE = 4;
const DEFAULTS = {
variant: "info",
duration: 4000,
};
package com.example.billing.config;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration