import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "./schema";
import { envs } from "@/config/envs";
const globalForDrizzle = global as unknown as {
db: ReturnType<typeof drizzle>;
client: ReturnType<typeof postgres>;
};
/**
* When configuring Drizzle with Supabase the property `prepare` must be FALSE.
* https://supabase.com/docs/guides/database/drizzle
*/
const client =
globalForDrizzle.client ?? postgres(envs.DATABASE_URL, { pconst button = document.getElementById("swipe-button");
const container = document.getElementById("swipe-container");
let startX = 0;
button.addEventListener("touchstart", (e) => {
startX = e.touches[0].clientX;
});
button.addEventListener("touchmove", (e) => {
const currentX = e.touches[0].clientX;
const offset = Math.min(
container.offsetWidth - button.offsetWidth,
currentX - startX
);
button.style.transform = `translateX(${offset}px)`;
});
button.addEvent// using the descript method
import { test, expect } from '@playwright/test';
test.describe('two tests', () => {
test('one', async ({ page }) => {
// ...
});
test('two', async ({ page }) => {
// ...
});
});npx test filename.spec.ts --grep groupName
// Ejemplo de instanciar contenido dinámicamente y pasarle parámetros
$s.=$Plugins->botones(["_escritura"=>true,
"botones"=>[
"menu2"=>[
"rotulo"=>"Abrir emergente con fecha",
"ayuda"=>"Este emergente es para ver si carga hammer.js",
"tipo" => "normal",
"tamaño" => 2,
"emergente"=>[
"titulo"=>"Instancia Quontrol en Emergente",
"api"=>["api"=>"SoporteAplicaciones.insertaEditor",
"carga_id"=> 6,
"parametros"=>[
"campo"=>"fecha",
"tipo"=>"fecha2"/**
* @param {number[]} arr
* @return {number}
*/
var minJumps = function(arr) {
const n = arr.length;
if (n === 1) return 0;
// Map value -> list of indices
const map = new Map();
for (let i = 0; i < n; i++) {
if (!map.has(arr[i])) map.set(arr[i], []);
map.get(arr[i]).push(i);
}
const queue = [0];
const visited = new Array(n).fill(false);
visited[0] = true;
let steps = 0;
while (queue.length > 0) {
const size = queue.len# https://playwright.dev/docs/test-retries#retries
npx playwright test --retries=3
JonDurbin/**
* @param {number[]} arr
* @param {number} start
* @return {boolean}
*/
var canReach = function(arr, start) {
const n = arr.length;
const queue = [start];
const visited = new Array(n).fill(false);
visited[start] = true;
while (queue.length > 0) {
const i = queue.shift();
// If we reached a zero, we're done
if (arr[i] === 0) return true;
// Try both directions
const next1 = i + arr[i];
const next2 = i - arr[i];
English Reading Task: Global Affairs
C2 Level – Advanced Comprehension and Analysis
Reading Text
In recent years, global affairs have become increasingly complex and
interconnected. International organisations, such as the United Nations and the
World Health Organization, play a pivotal role in addressing transnational
challenges, including climate change, pandemics, and economic instability. These
issues rarely remain confined within national borders; instead, they spread rapidly
thro/**
* @param {number[]} nums
* @return {number}
*/
var findMin = function(nums) {
let left = 0, right = nums.length - 1;
while (left < right) {
const mid = Math.floor((left + right) / 2);
if (nums[mid] < nums[right]) {
right = mid; // min is in [left, mid]
} else if (nums[mid] > nums[right]) {
left = mid + 1; // min is in [mid, right]
} else {
right--; // duplicates: shrink safely
/**
* @param {number[]} nums
* @return {number}
*/
var findMin = function(nums) {
let left = 0;
let right = nums.length - 1;
while (left < right) {
const mid = Math.floor((left + right) / 2);
// If mid element is greater than the rightmost,
// the minimum is in the right half.
if (nums[mid] > nums[right]) {
left = mid + 1;
} else {
// Otherwise, the minimum is in the left half (including mid)
right = midhttps://claude.ai/public/artifacts/c314b2b5-f351-4e94-bb24-752c4d255a4bnpx playwright test --trace on
# then to see the trace
npx playwright show-report
Pearson Correlation
pearson_coef, p_value = stats.pearsonr(df['']. df[''])/**
* @param {number[]} nums
* @return {boolean}
*/
var isGood = function(nums) {
const n = Math.max(...nums);
// Condition 1: length must be n + 1
if (nums.length !== n + 1) return false;
// Count frequencies
const freq = new Map();
for (let x of nums) {
freq.set(x, (freq.get(x) || 0) + 1);
}
// Check 1..n-1 appear exactly once
for (let i = 1; i < n; i++) {
if (freq.get(i) !== 1) return false;
}
// Check n appears exactly twice