package ratelimit
import (
"sync"
"time"
)
-- KEYS[1] = bucket key
-- ARGV: capacity, refillPerSec, now(ms), cost, ttl(sec)
local capacity = tonumber(ARGV[1])
local refill = tonumber(ARGV[2])
local now = tonumber(ARGV[3])
local cost = tonumber(ARGV[4])
const MAX_LIMIT = 100;
const DEFAULT_LIMIT = 20;
const ALLOWED_ORDER = new Set(['asc', 'desc']);
function decodeCursor(raw) {
const json = Buffer.from(raw, 'base64').toString('utf8');
module RequestStore
def self.store
Thread.current[:request_store] ||= {}
end
def self.fetch(key)
use std::collections::HashMap;
use std::fmt;
#[derive(Debug, Clone)]
pub struct Document {
pub body: String,
-- KEYS[1] = bucket key
-- ARGV[1] = capacity, ARGV[2] = refill_per_sec, ARGV[3] = now (float seconds)
local capacity = tonumber(ARGV[1])
local rate = tonumber(ARGV[2])
local now = tonumber(ARGV[3])
package main
import (
"log"
"net/http"
"time"
const multer = require('multer');
const ALLOWED_MIME = new Set(['image/jpeg', 'image/png', 'image/webp']);
function fileFilter(req, file, cb) {
if (!ALLOWED_MIME.has(file.mimetype)) {
use axum::{
extract::{FromRequestParts, State},
http::{request::Parts, StatusCode},
response::{IntoResponse, Response},
Json,
};
module QueryBudget
class Counter
IGNORED = %w[SCHEMA CACHE TRANSACTION].freeze
attr_reader :count
<?php
namespace App\Jobs;
use App\Models\Invoice;
use App\Services\StripeGateway;
<?php
declare(strict_types=1);
namespace App\Security;