This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import | |
import { useAuth0 } from '@auth0/auth0-react' | |
// hook | |
const { loginWithPopup } = useAuth0() | |
// Action | |
function handlePermission() { | |
loginWithPopup({ | |
authorizationParams: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Browser, Page } from '@playwright/test' | |
import path from 'node:path'; | |
interface IBaseTestController { | |
browser?: Browser | |
page: Page | |
baseURL: string | |
path?: string | |
har: { | |
title: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"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" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
postgres: | |
image: postgres | |
restart: always | |
environment: | |
POSTGRES_DB: ${POSTGRES_DB} | |
POSTGRES_USER: ${POSTGRES_USER} | |
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | |
ports: |
NewerOlder