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;
<?php
namespace App\Http\Requests\Wizard;
use Illuminate\Foundation\Http\FormRequest;
package proxy
import (
"log"
"net"
"net/http"
class SlidingWindowLimiter
Result = Struct.new(:allowed, :count, :limit, :window_ms, keyword_init: true)
SCRIPT = <<~LUA.freeze
local key = KEYS[1]
local now = tonumber(ARGV[1])
use dashmap::DashMap;
use std::time::Instant;
pub struct TokenBucket {
tokens: f64,
last_refill: Instant,
package api
import (
"encoding/json"
"encoding/xml"
"net/http"
class ApiError extends Error {
constructor(statusCode, message, code) {
super(message);
this.name = 'ApiError';
this.statusCode = statusCode;
this.code = code || null;
const crypto = require('crypto');
function computeStrongEtag(body) {
const buf = Buffer.isBuffer(body) ? body : Buffer.from(String(body));
const digest = crypto.createHash('sha1').update(buf).digest('base64');
return '"' + digest + '"';