Custom css scrollbars (No Firefox support)

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.box {
	height: 300px;
	overflow: auto;
}

.box::-webkit-scrollbar {
    width: 5px;
}

.box::-webkit-scrollbar-track {
  box-shadow: inset 0 0 5px grey;
  border-radius: 15px;
}

.box::-webkit-scrollbar-thumb {
  background-color: orange;
  border-radius: 15px;
}

.box::-webkit-scrollbar-thumb:hover {
  background: red; 
}

Try/Catch block javascript

const fetchData = async () => {
  try {
    const response = await fetch('https://api.example.com/data');
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error('Error:', error);
  }
}

fetchData();

1404. Number of Steps to Reduce a Number in Binary Representation to One

Given the binary representation of an integer as a string s, return the number of steps to reduce it to 1 under the following rules: If the current number is even, you have to divide it by 2. If the current number is odd, you have to add 1 to it. It is guaranteed that you can always reach one for all test cases.
/**
 * @param {string} s
 * @return {number}
 */
var numSteps = function(s) {
    // Convert the binary string to an array of characters for easier manipulation
    let binary = s.split('');

    // Initialize a counter for the number of steps
    let steps = 0;

    // While the binary number is not "1"
    while (binary.length > 1 || binary[0] != '1') {
        // If the last digit is '0', the number is even
        if (binary[binary.length - 1] === '0') {
            // Divide by 2 by simply 

AD User PwdLastSet

Get-ADUser -Identity <samAccountName/distinguishedname of user>`
-Server <domainName> -Properties pwdLastSet| select @{name ="pwdLastSet" expression={[datetime]::FromFileTime($_.pwdLastSet)}}

Add Custom CSS class to body with ACF

/*

In ACF, define a text field with name "body_class"

*/


///functions.php

// add custom CSS class to body set with ACF
add_filter( 'body_class', 'custom_body_class' );
/**
 * Add custom field body class(es) to the body classes.
 *
 * It accepts values from a per-page custom field, and only outputs when viewing a singular static Page.
 *
 * @param array $classes Existing body classes.
 * @return array Amended body classes.
 */
function custom_body_class( array $classes ) {
	$new_class = is_p

Replace a particular character using css

Saved from https://www.bing.com/search?q=change+character+in+css&PC=U316&FORM=CHROMN
element {
text-indent: -9999px;
line-height: 0;
/* Collapse the original line */
}

.element::after {
content: "New text";
text-indent: 0;
display: block;
line-height: initial;
/* New content takes up original line height */
}

Select drop down change selected option

 $('select option').eq(3).prop("selected", true); // change to third option
 $('select').trigger("change"); // trigger select change

phone mask

<input id="phone-mask" type="text" value="" placeholder="+7 (000) 000-00-00" required>

Optymalizacja Dyrektywy ClickOutside w Angularze

### Optymalizacja Dyrektywy `ClickOutside` w Angularze

#### Kontekst
Masz dyrektywę Angulara `ClickOutside`, która wykrywa kliknięcia poza elementem, do którego jest przypięta, i emituje zdarzenie `appClickOutside`. W aplikacji, gdzie wiele komponentów może używać tej dyrektywy, każda instancja nasłuchuje na zdarzenia kliknięcia w dokumencie, co może być nieefektywne.

#### Cel
Celem jest optymalizacja dyrektywy tak, aby nasłuchiwanie na kliknięcie poza elementem z dyrektywą było inicjowa

stepper

<div class="stepper" data-stepper>
  <button class="stepper__button button-reset" aria-label="Уменьшить количество" data-stepper-minus>-</button>
  <input class="stepper__input input-reset" type="number" min="1" max="999" value="1" data-stepper-input>
  <button class="stepper__button button-reset" aria-label="Увеличить количество" data-stepper-plus>+</button>
</div>

隐式类型转换

# Default Type Promotions and Conversions

https://www.eskimo.com/~scs/cclass/int/sx4cb.html

* First, in most circumstances, values of type char and short int are converted to int right off the bat.
* If an operation involves two operands, and one of them is of type long double, the other one is converted to long double.
* If an operation involves two operands, and one of them is of type double, the other one is converted to double.
* If an operation involves two operands, and one of them is of

Install CodeChecker Linux

# Install CodeChecker
Source: https://github.com/Ericsson/codechecker?tab=readme-ov-file

## Install base application
Can be installed using python:

```
$ python -m pip install codechecker
```

You need to install some of the supported analyzers like _cppcheck_ and _clangsa_.

```
$ sudo apt install cppcheck clang
```

## Usage
Generate analysis data:

```
$ CodeChecker check -b "cd ~/your-project && make clean && make" -o ./results
```

You can visualize the results as static HTML by executing

cte -NADC dups

CREATE TEMP TABLE dup_ref_acc_no (lpnot VARCHAR);
\copy dup_ref_acc_no FROM 'webpas_topas_NADC_splits_lpnot';

WITH extracted_data AS (
    SELECT
        tmp.lpnot,
        np.lpno,
        ds.did,
        data #>> '{0,raw_gname,0}' AS gname,
        data #>> '{0,raw_sname,0}' AS sname,
        data #>> '{0,dob,0}' AS dob,
        ltrim(data #>> '{0,ref_acc_no,0}','0') AS ref_acc_no,
        data #>> '{0,ref_rec_date,0}' AS ref_rec_date,
        data #>> '{0,hospcode,0}' AS hospcod

Disconnect DB after Test Done

Disconnect DB after Test Done
# Disconnect DB after Test Done

环境:

- Jest
- Postgres
- Knex

如果不断数据库连接,测试完成后会报:

```txt
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
```

解决方法:

```js
// Knex setting file
const config = {
  client: 'pg',
  connection: {
    host: process.env.DB_HOST || 'localhost',
    user

installed for J

abseil is already installed.
aom is already installed.
apr is already installed.
apr-util is already installed.
argon2 is already installed.
aribb24 is already installed.
aspell is already installed.
assimp is already installed.
autoconf is already installed.
bat is already installed.
bison is already installed.
broot is already installed.
brotli is already installed.
btop is already installed.
c-ares is already installed.
ca-certificates is already installed.
cairo is already installed.
capston

macOS setup

#!/usr/bin/env bash

# ~/osx.sh — Originally from https://mths.be/osx

# Ask for the administrator password upfront
sudo -v

# Keep-alive: update existing `sudo` time stamp until `osx.sh` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

###############################################################################
# General UI/UX                                                               #
##########################################################