Skip to content

Instantly share code, notes, and snippets.

View AlexcastroDev's full-sized avatar
🚀
Let's go !!!!

Alexandro Castro AlexcastroDev

🚀
Let's go !!!!
  • Flecto
  • Portugal
View GitHub Profile
@AlexcastroDev
AlexcastroDev / rate_limit_shopify.rb
Last active June 6, 2024 10:55
rate_limit_shopify.rb
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "faker"
require 'time'
module SomethingLib
class Images
@last_called = nil
@call_count = 0
BING_API_LIMIT = 5
INTERVAL = 1 # 1 second interval
def self.generate(title)
import { Browser, Page } from '@playwright/test'
import path from 'node:path';
interface IBaseTestController {
browser?: Browser
page: Page
baseURL: string
path?: string
har: {
title: string
version: '3.8'
x-postgres-defaults: &postgres-defaults
image: postgres:latest
environment:
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: your_password
POSTGRES_DB: your_database
volumes:
- pgdata:/var/lib/postgresql/data
private async requestWithRetry(
query: string,
username: string,
retryDelay: number = 1000, // Set the delay between retries (in milliseconds)
) {
const tokens = [
Deno.env.get("GITHUB_TOKEN1"),
Deno.env.get("GITHUB_TOKEN2"),
];
const maxRetries = tokens.length
@AlexcastroDev
AlexcastroDev / db.json
Last active August 7, 2023 04:42
public_links
[
{
"details": {
"summary": "An Elo-type rating model for players and teams of variable strength",
"p": "The Elo rating system, which was originally proposed by Arpad Elo for chess, has become one of the most important rating systems in sports, economics and gaming nowadays. Its original formulation is based on two-player zero-sum games, but it has been adapted for team sports and other settings. In 2015, Junca and Jabin proposed a kinetic version of the Elo model..."
},
"link": "https://arxiv.org/abs/2109.15046"
}
]
const transform = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' })
async function readUserInput(): Promise<number> {
const buffer = new Uint8Array(1024);
const bytesRead = await Deno.stdin.read(buffer);
const input = new TextDecoder().decode(buffer.subarray(0, Number(bytesRead)));
if (Number.isNaN(Number(input))) {
throw new Error('No bytes read');
}
import express from "express"
const app = express ();
app.get("/events",(req, res) => {
res. setHeader ("Content-Type", "text/event-stream");
res.setHeader ("Cache-Control", "no-cache");
res.setHeader ("Connection","keep-alive");
// Clean headers
res.flushHeaders();
version: '3.3'
services:
postgres:
image: postgres
restart: always
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports: