Skip to content

Instantly share code, notes, and snippets.

View eliseumds's full-sized avatar

Eliseu Monar dos Santos eliseumds

View GitHub Profile
@eliseumds
eliseumds / recencyBoost.ts
Created December 8, 2025 17:35
Run it with:
import { sql } from 'bun';
async function fetch(categorySlug: string, sortBy: 'mostBenefitedFirst' | 'mostBenefitedLast') {
const order = sortBy === 'mostBenefitedFirst' ? sql`ORDER BY diff DESC` : sql`ORDER BY diff ASC`;
return await sql`
SELECT
e.slug,
es.reviewApprovedCountAggregation,
es.ratingAggregation,
SUM(r.rating * (1 + (730 - LEAST(DATEDIFF(CURDATE(), r.firstPublishedAt), 730)) / 730)) / SUM(1 + (730 - LEAST(DATEDIFF(CURDATE(), r.firstPublishedAt), 730)) / 730) AS boostedRating,
@eliseumds
eliseumds / private_message_moderation_threads.local.json
Created February 10, 2026 15:17
Inside the `bin/` directory. Run it with:
[
{
"id": "c2c-friendly-question",
"description": "Friendly consumer-to-consumer question about a review, clearly allowed.",
"exchangeType": "consumer to consumer",
"threadHistory": [],
"message": {
"body": "Hey, I saw your review about the washing machine. Has it still been working well after a year? I'm deciding whether to buy it.",
"role": "consumer"
},