const { EventEmitter } = require('events');
const HIGH_WATER_MARK = 1 << 20; // 1 MiB of buffered bytes per client
class SseHub extends EventEmitter {
constructor() {
#[derive(Debug, Clone, Copy)]
pub struct ByteRange {
pub start: u64,
pub end: u64, // inclusive
}
use chrono::NaiveDate;
use rust_decimal::Decimal;
use serde::{Deserialize, Deserializer};
#[derive(Debug, Clone, Deserialize)]
pub struct Transaction {
class DownloadsController < ApplicationController
before_action :authenticate_user!, only: :create
skip_before_action :verify_authenticity_token, only: :show
def create
document = current_user.documents.find(params[:document_id])
'use strict';
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
function backoffDelay(attempt, baseMs, maxDelayMs) {
const exponential = baseMs * 2 ** attempt;
package com.example.paging;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Interval {
pub start: i64,
pub end: i64,
}
export const required = (msg = 'This field is required') => (value) =>
value && value.trim() !== '' ? '' : msg;
export const minLength = (n, msg) => (value) =>
value && value.length >= n ? '' : msg || `Must be at least ${n} characters`;
class AddVersionsToArticles < ActiveRecord::Migration[7.1]
def change
add_column :articles, :versions, :jsonb, null: false, default: []
add_index :articles, :versions, using: :gin
end
end
package pqueue
type Job struct {
ID string
Payload interface{}
Priority int
@Entity
@Table(name = "stored_files")
public class StoredFile {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
import { useCallback, useEffect, useState } from "react";
type Patch = Record<string, string | null | undefined>;
function readParams(): URLSearchParams {
return new URLSearchParams(window.location.search);