<?php
namespace App\Message;
final class PurgeExpiredTokensMessage
{
const { AsyncLocalStorage } = require('async_hooks');
const storage = new AsyncLocalStorage();
function runWithTenant(tenantId, userId, callback) {
return storage.run({ tenantId, userId }, callback);
import { useCallback, useState } from 'react';
type CopiedValue = string | null;
type CopyFn = (text: string) => Promise<boolean>;
function legacyCopy(text: string): boolean {
package com.example.security.metrics;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.stereotype.Service;
class DiscountCode < ApplicationRecord
has_many :redemptions, dependent: :destroy
enum discount_type: { percentage: 0, fixed: 1 }
validates :code, presence: true, uniqueness: { case_sensitive: false }
package webhooksign
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
from rest_framework.versioning import BaseVersioning
from rest_framework.exceptions import NotAcceptable
class AcceptHeaderVersioning(BaseVersioning):
default_version = "1"
class DeadlineError extends Error {
constructor(message = 'request deadline exceeded') {
super(message);
this.name = 'DeadlineError';
this.code = 'DEADLINE_EXCEEDED';
}
class LoginCode < ApplicationRecord
belongs_to :user
CODE_LENGTH = 6
TTL = 10.minutes
import logging
import re
_BASE_FIELDS = set(logging.makeLogRecord({}).__dict__.keys())
_PATTERNS = [
package com.shop.shipping;
import java.math.BigDecimal;
public interface ShippingCostCalculator {
'use strict';
function dedupeAsync(producer, keyFn) {
const pending = new Map();
const resolveKey = keyFn || ((...args) => JSON.stringify(args));