import Redis from "ioredis";
export const redis = new Redis(process.env.REDIS_URL ?? "redis://localhost:6379");
export interface Codec<T> {
encode(value: T): string;
class Order < ApplicationRecord
belongs_to :customer
scope :for_export, -> {
select(:id, :reference, :total_cents, :currency, :created_at, :customer_id)
.where.not(exported_at: nil)
module ConditionalGet
extend ActiveSupport::Concern
private
def render_conditional(resource, extra: nil)
package main
import (
"os"
"runtime/debug"
"strconv"
use rayon::prelude::*;
fn main() {
let numbers: Vec<_> = (0..1000).collect();
let sum: i32 = numbers
-- Basic query debugging with EXPLAIN
EXPLAIN SELECT * FROM users WHERE email = 'test@example.com';
-- Output shows query plan:
-- Seq Scan on users (cost=0.00..25.00 rows=1 width=100)
-- Filter: (email = 'test@example.com'::text)
CREATE TABLE daily_events (
id BIGSERIAL PRIMARY KEY,
category TEXT NOT NULL,
item_id BIGINT NOT NULL,
score NUMERIC(10,2) NOT NULL DEFAULT 0,
occurred_at TIMESTAMPTZ NOT NULL DEFAULT now()
import { useState, useMemo, useCallback } from 'react'
import { Post } from '@/types'
import { PostCard } from './PostCard'
interface FilteredPostsProps {
posts: Post[]
import Foundation
import UIKit
// MARK: - Memory Leak Prevention
class ImageDownloader {
private var tasks: [URL: URLSessionDataTask] = [:]
use std::collections::HashMap;
use std::hash::Hash;
use std::sync::{Arc, RwLock};
pub struct Memoizer<K, V> {
store: RwLock<HashMap<K, Arc<V>>>,
import { useEffect, useState, useRef } from 'react'
interface UseInViewOptions {
threshold?: number | number[]
rootMargin?: string
triggerOnce?: boolean
<?php
namespace App\Services;
use App\Models\Order;
use Illuminate\Support\Facades\Cache;