class PriceBreakdown < Struct.new(:subtotal_cents, :discount_cents, :tax_cents, keyword_init: true)
def initialize(*)
super
freeze
end
<?php
namespace App\Dto;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Interval {
pub start: i64,
pub end: i64,
}
import { useEffect, useState } from 'react';
export function useLocalStorage<T>(
key: string,
initialValue: T
): [T, (value: T) => void] {
class BatchLoader {
constructor(batchFn, { cacheKeyFn = (k) => k } = {}) {
this.batchFn = batchFn;
this.cacheKeyFn = cacheKeyFn;
this.cache = new Map();
this.queue = [];
@Component
public class SalesRollupScheduler {
private static final Logger log = LoggerFactory.getLogger(SalesRollupScheduler.class);
private static final int ROLLUP_WINDOW_DAYS = 3;
from dataclasses import dataclass, field
from datetime import datetime, timezone
from decimal import Decimal
def _now():
package scheduler
import (
"context"
"log"
"sync"
class InventoryLevel < ApplicationRecord
belongs_to :warehouse
UPSERT_COLUMNS = %w[warehouse_id sku on_hand reserved updated_at].freeze
def self.upsert_counts(rows)
from alembic import op
import sqlalchemy as sa
revision = "20240612_add_status"
down_revision = "20240515_create_orders"
branch_labels = None
class User < ApplicationRecord
normalizes :phone, with: ->(value) { PhoneNormalizer.call(value) }, apply_to_nil: false
validates :phone,
presence: true,
uniqueness: { case_sensitive: false },
import { useMemo } from "react";
export type SortDir = "asc" | "desc";
export interface SortConfig<T> {
key: keyof T;
dir: SortDir;