function throttle(fn, delay) {
let lastCall = 0;
return function (...args) {
const now = new Date().getTime();
if (now - lastCall >= delay) {
lastCall = now;
fn.apply(this, args);
}
};
}
/**
* Finds the minimum time required to reach the bottom-right cell of the grid.
* Each cell contains a time constraint that dictates the earliest possible arrival.
*
* @param {number[][]} moveTime - A 2D array representing the minimum time required
* to step into each cell.
* @return {number} - The minimum time required to reach the last cell, or -1 if unreachable.
*/
var minTimeToReach = function(moveTime) {
const rows = moveTime.length;
const co
<div class="radius">Squircle</div>
[Channel]
Retail
<?php
// via https://stackoverflow.com/a/15075609
This method was posted by @lauthiamkok in the comments. I'm posting it here as an answer to call more attention to it.
Depending on your needs, you should consider using filter_var() with the FILTER_VALIDATE_BOOLEAN flag.
filter_var( true, FILTER_VALIDATE_BOOLEAN); // true
filter_var( 'true', FILTER_VALIDATE_BOOLEAN); // true
filter_var( 1, FILTER_VALIDATE_BOOLEAN); // true
filter_var( '1', FILTER_VALIDATE_BOOLEAN); // t
https://stackoverflow.com/questions/55147656/why-am-i-having-so-many-records-after-a-join
TableA
Number, Text
----
1, Hello
1, There
1, World
TableB
Number, Text
----
1, Foo
1, Bar
1, Baz
SELECT * FROM TableA a INNER JOIN TableB b ON a.Number = b.Number
a.Number, a.Text, b.Number, b.Text
----------------------------------
1, Hello, 1, Foo
1, Hello, 1, Bar
1, Hello, 1, Baz
1, There, 1, Foo
1, There, 1, Bar
1, There, 1, Baz
1, World, 1, Foo
1, World, 1, Bar
1, World
/**
* @param {number[]} nums
* @return {number[]}
*/
var buildArray = function(nums) {
let ans = []; // Initialize an empty array to store the result
// Iterate through each index in the `nums` array
for (let i = 0; i < nums.length; i++) {
ans.push(nums[nums[i]]); // Push the element from `nums` at the index specified by `nums[i]`
}
return ans; // Return the resulting array
};
select
stats.Table_name,
stats.Index_name,
stats.user_seeks,
i.seeks as snapshot_seeks,
stats.user_seeks - i.seeks as diff_seeks,
stats.user_scans,
i.scans as snapshot_scans,
stats.user_scans - i.scans as diff_scans,
stats.user_updates,
i.updates as snapshot_updates,
stats.user_updates - i.updates as diff_updates
from (
SELECT
objects.name AS Table_name,
indexes.name AS Index_name,
dm_db_index_usage_stats.user_seeks,
dm_db_index_usage_
insert into index_usage (tableName, indexName, seeks, scans, updates)
SELECT
objects.name AS Table_name,
indexes.name AS Index_name,
dm_db_index_usage_stats.user_seeks,
dm_db_index_usage_stats.user_scans,
dm_db_index_usage_stats.user_updates
FROM
sys.dm_db_index_usage_stats
INNER JOIN sys.objects ON dm_db_index_usage_stats.OBJECT_ID = objects.OBJECT_ID
INNER JOIN sys.indexes ON indexes.index_id = dm_db_index_usage_stats.index_id AND dm_db_index_usage_stat
/*
https://javascript.plainenglish.io/3-powerful-ways-to-share-data-across-browser-tabs-in-javascript-a6a98dffa1a3
*/
// 1. local storage
// Sender
localStorage.setItem('sharedData', JSON.stringify({
message: 'Hello from Tab1!',
timestamp: Date.now()
}));
// Receiver
window.addEventListener('storage', (e) => {
if(e.key === 'sharedData') {
const data = JSON.parse(e.newValue);
console.log('Received data:', data);
}
});
// 2. BroadcastChannel API
// Create a channel (use the
/*------------------------------------------------------------------
Custom Font
-------------------------------------------------------------------*/
@import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);
/* Import font face*/
/* @font-face {
font-family: 'Adieu';.center
src: url("{{'Adieu-Bold.eot' | asset_url }}");
src: url("{{'Adieu-Bold.eot?iefix' | asset_url }}") format('eot'),
url("{{'Adieu-Bold.woff' | asset_url }}") format('woff'),
url("
/**
* Calculates the number of ways to tile a 2 × n board using dominos and trominos.
* @param {number} n - The width of the board.
* @return {number} - The number of valid tilings, modulo 10^9 + 7.
*/
var numTilings = function (n) {
const MOD = 1e9 + 7; // Modulo constraint to prevent overflow
// Base cases for small values of n
if (n === 1) return 1; // Only one vertical domino fits
if (n === 2) return 2; // Two configurations: vertical or horizontal dominos
// Create
не открывается https://wsbill.wpstage.by/
sudo resolvectl dns ppp0 172.16.48.3 172.16.48.11
sudo systemctl restart systemd-resolved
# How to become a high quality software engineer?
/**
* Counts the number of equivalent domino pairs.
* Two dominoes are equivalent if they have the same numbers, regardless of order.
*
* @param {number[][]} dominoes - A list of domino pairs represented as 2-element arrays.
* @return {number} - The total number of equivalent domino pairs.
*/
var numEquivDominoPairs = function(dominoes) {
// If there are no dominoes, return 0
if (!dominoes || dominoes.length === 0) {
return 0;
}
let numPairs = 0; // Counter for eq