export interface Page<T> {
items: T[];
nextCursor: string | null;
}
export interface Post {
import { useState, useRef, useEffect, useCallback } from 'react';
export function useOnScreen(options = {}) {
const [node, setNode] = useState(null);
const [isIntersecting, setIsIntersecting] = useState(false);
import base64
import json
from datetime import datetime
from typing import NamedTuple
from fastapi import HTTPException
package com.example.catalog.web;
import com.example.catalog.domain.Product;
import java.math.BigDecimal;
public record ProductResponse(
@RestController
@RequestMapping("/api/exports")
public class ExportController {
private final CsvStreamWriter csvStreamWriter;
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Resources\PostResource;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub struct Page<T> {
pub items: Vec<T>,
#[serde(default)]
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');
class InvoicesController < ApplicationController
def index
invoices = InvoicesQuery.new(current_account.invoices, filter_params).call
@invoices = invoices.page(params[:page]).per(25)
render :index
Rails.application.routes.draw do
namespace :api, defaults: { format: :json } do
namespace :v1 do
resources :articles, only: [:index, :show, :create, :update, :destroy]
resources :sessions, only: [:create]
end
require 'uri'
require 'rack/utils'
module PaginationLinks
module_function
class Article < ApplicationRecord
has_many :taggings, dependent: :destroy
has_many :tags, through: :taggings
scope :published, -> { where.not(published_at: nil) }