/**
* @param {string[]} nums
* @return {string}
*/
var findDifferentBinaryString = function(nums) {
const n = nums.length;
const numsSet = new Set(nums);
// Generate all possible binary strings of length n
for (let i = 0; i < 2 ** n; i++) {
// Convert the number i to a binary string of length n
const binaryString = i.toString(2).padStart(n, '0');
// Check if the generated binary string is not in numsSet
if (!numsSet.has(binaryString)) {
function map_posts() {
// wp_query or get_posts()
$p = get_posts(['post_type' => 'post', 'posts_per_page' => 5]);
if(!$p) return ["Error", "No more posts found!"];
// Anzichè un foreach, questo array map ti fa restituire un array di tutti campi che vuoi. Nota solo che la array viene inserito come secondo argomento.
$posts = array_map(function ($post) {
return [
'id' => $post->ID,
'title' => $post->post_title,
'image' => get_the_post_thumbnail_url(
function create_vip_order() {
global $woocommerce;
$address = array(
'first_name' => '111Joe',
'last_name' => 'Conlin',
'company' => 'Speed Society',
'email' => 'joe@testing.com',
'phone' => '760-555-1212',
'address_1' => '123 Main st.',
'address_2' => '104',
'city' => 'San Diego',
'state' => 'Ca',
'postcode' => '92121',
'country' => 'US'
);
// Now we create the order
$order = wc_create
# How to check the driver used by a device in linux
## The fast way
Simply:
```
$ sudo lspci -v
```
And check the result for your device:
```
08:00.0 Ethernet controller: Intel Corporation 82571EB/82571GB Gigabit Ethernet Controller (Copper) (rev ff) (prog-if ff)
...
Kernel driver in use: e1000e
Kernel modules: e1000e
```
## The manual way
First, check the devices id in the pci bus by:
```
$ sudo lspci
```
It should show something like:
```
00:00.0 Host bridge: Intel Corporation 8th G
/** Show the banner when a html element with class 'cmplz-show-banner' is clicked **/
function cmplz_show_banner_on_click() {
?>
<script>
function addEvent(event, selector, callback, context) {
document.addEventListener(event, e => {
if ( e.target.closest(selector) ) {
callback(e);
}
});
}
addEvent('click', '.cmplz-show-banner', function(){
document.querySelectorAll('.cmp
<div class="corner corner-1"></div>
<div class="corner corner-2"></div>
<div class="corner corner-3"></div>
<div class="corner corner-4"></div>
git rm --cached test.html - убрать отслеживание файла из гита, перед этим добавить в гитигнор
git revert 222222хеш - отменяет последний комит
git commit -am "название комита" - добавить в гиб без add .
<div class="box"></div>
function activityNotifications(expenditure, d) {
let notifications = 0;
let median = 0;
let middle = 0;
const n = expenditure.length;
for (let i = d; i < n; i++) { // Start from `d`, not `d - 1`
let trailingExpenditures = expenditure.slice(i - d, i); // Correct trailing selection
let sortedExpenditures = [...trailingExpenditures].sort((a, b) => a - b);
middle = Math.floor(sortedExpenditures.length / 2);
if (sortedExpenditures.length % 2 =
class Player {
constructor(name, score) {
this.name = name;
this.score = score;
}
greet(){
console.log(`Hello, my name is ${this.name} and I am ${this.age} years old.`);
}
}
class Checker {
//means we don’t need to create an object
static compare(a, b) {
// Sort by score in descending order
if (a.score !== b.score) {
return b.score - a.score;
}
// If scores are the same, sort by name in ascending orde
function maximumToys(prices, k) {
// Sort prices in ascending order to buy cheapest toys first
prices.sort((a, b) => a - b);
let maxToys = 0;
let totalCost = 0;
for (let i = 0; i < prices.length; i++) {
if (totalCost + prices[i] <= k) {
totalCost += prices[i];
maxToys++;
} else {
break; // Stop if we exceed budget
}
}
return maxToys;
}
function countSwaps(a) {
let swaps = 0;
const n = a.length;
//[6, 4, 1]
for (let i = 0; i < n - 1; i++) { // Outer loop (passes)
for (let j = 0; j < n - i - 1; j++) { // Inner loop (comparison)
if (a[j] > a[j + 1]) {
[a[j], a[j + 1]] = [a[j + 1], a[j]]; // Swap
swaps++;
}
}
}
const firstElement = a[0];
const lastElement = a[(n - 1)];
console.log(`Array is sorted in ${swaps} swaps.`);
Renaming the .app package in Finder only changes the name there, it doesn't change the name shown in the menu. To do so edit `YOUR.app/Contents/Resources/XY.lproj/InfoPlist.strings` (with XY being the language you are using) and change `CFBundleName` there.
For applications without localization files you can also edit `YOUR.app/Contents/Info.plist` and set a new value for `CFBundleName` there.
<?php
// Set different prices in WooCommerce based on user roles using a hook.
function custom_role_based_pricing( $price, $product ) {
if ( is_user_logged_in() ) {
$user = wp_get_current_user();
// Example: 10% discount for "wholesale" users
if ( in_array( 'wholesale', $user->roles ) ) {
$price = $price * 0.90; // 10% off
}
// Example: 20% discount for "vip" users
if ( in_array( 'vip', $user->roles ) ) {
/**
* @param {number} n
* @param {number} k
* @return {string}
*/
var getHappyString = function(n, k) {
// Helper function to perform backtracking and generate all happy string
function backtrack(current, result) {
// If the current string has reached the desired length, add it to the result list
if (current.length === n) {
result.push(current);
return;
}
// Iterate through the characters 'a', 'b', 'c'
for (let char of [
$JobGuid = '896c75c7-7b35-40f2-abb3-faff54ce5ab9'
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers.Name | Sort-Object | ForEach-Object {
$ServerName = $_
Write-Host "Running job against $ServerName..."
$ScriptBlock = {
Invoke-Command -ComputerName $args[0] -ScriptBlock {
$EventMessageText = 'System.OutOfMemoryException'
$LastBootUpTime = Get-CimInstance -ClassName Win32_OperatingSystem -ErrorAction St