Bootstrap Hover Menu

/* ============ desktop view ============ */
@media all and (min-width: 992px) {
    .navbar .nav-item .dropdown-menu{ display: none; }
    .navbar .nav-item:hover .nav-link{ color: #fff;  }
    .navbar .nav-item:hover .dropdown-menu{ display: block; }
    .navbar .nav-item .dropdown-menu{ margin-top:0; }
}   
/* ============ desktop view .end// ============ */ 
 

Elasticsearch

launchctl kickstart -kp gui/$UID/homebrew.mxcl.elasticsearch-full

useSocketData

import { useEffect, useState } from 'react'
import { useRedux } from '@/hooks/useRedux'
import {
  selectCurrencyPrices,
  setCurrencyPrices,
  TPrices,
  setInit,
} from '@/store/currencyPrices'
import { EchoInit, EchoSubscribe } from '@/utils/setLaravelEcho'
import { selectUser } from '@/store/user'

type TUseSocketData = {
  prices: TPrices[] | null
  subscribe: () => void
}

export const useSocketData = (): TUseSocketData => {
  const [hasSubscribe, setHasSubscribe] = useState(false)
  const

Component with socket init

import { FC, useEffect } from 'react'
import { EchoDisconnect, EchoInit, EchoSubscribe } from '@/utils/setLaravelEcho'
import { useRedux } from '@/hooks/useRedux'
import { setCurrencyPrices, TPrices } from '@/store/currencyPrices'

export const CurrencySocket: FC = () => {
  const [, dispatch] = useRedux()

  const setSocketData = (data: TPrices[]) => {
    dispatch(setCurrencyPrices(data))
  }

  useEffect(() => {
    EchoInit()
    EchoSubscribe('currencyCourses', setSocketData)

    return ()

sprawdzenie czy obiekt posiada dany typ

interface Cat {
  name: string;
  puring: boolean;
}

interface Dog {
  name: string;
  wof: boolean;
}

type AllInOne = Cat | Dog;

export const isCat = (
  details: AllInOne
): details is Cat =>
  !!(details as Cat).puring;

const tusia: Cat = {
  name: 'tusia';
  puring: true;
}

console.log('is cat or dog?', isCat(tusia))

min_n

from copy import deepcopy

def min_n(lst, n=1):
    numbers = deepcopy(lst)
    numbers.sort()
    return numbers[:n]

Dynamic Shadow

<div class="dynamic-shadow"></div>

call

const call = (key, ...args) => context => context[key](...args);

Promise.resolve([1, 2, 3])
  .then(call('map', x => 2 * x))
  .then(console.log); // [ 2, 4, 6 ]
const map = call.bind(null, 'map');
Promise.resolve([1, 2, 3])
  .then(map(x => 2 * x))
  .then(console.log); // [ 2, 4, 6 ]

dunder

Use if __name__ == "__main__" to Control the Execution of Your Code
What if you want process_data() to execute when you run the script from the command line but not when the Python interpreter imports the file?

https://www.geeksforgeeks.org/python-main-function/

上スクロール時のみヘッダー表示

<header class="c-header--fixed js-fixedHeader"></header>

Force Jenkins Log Rotation

Force Jenkins Log Rotation

import jenkins.model.*
Jenkins.instance.getAllItems(AbstractProject.class)
.findAll { it.logRotator }
    .each {
      it.logRotator.perform(it)
    }

link existis

if (pHorasMarcacao.Exists(x=>x.HoraMarcacao == "00:00")) {
  sucesso = false; 
  mensagens.Add("A hora 00:00 informada não é válida."); 
}

jquery on click function

$(document).on('click','.element',function(){
  //code goes here
});

SiteMap

//https://www.livhospital.com/en/sitemap.xml
//https://www.livhospital.com/ru/sitemap.xml
//https://www.livhospital.com/ar/sitemap.xml

public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
               name: "EnSitemap",
               url: "en/sitemap.xml",
               defaults: new { controller = "Sitemap", action = "Index", id = Ur

slick slider custom dots thumbs

$(".quotes-slider").slick({
      dots: true,
      customPaging: function(slider, i) {
        var thumb = $(slider.$slides[i]).data("thumb");
        return '<a><img src="' + thumb + '"></a>';
      },
      arrows: false,

    });

Special characters not allowed input field HTML expression

 onkeypress="return /[0-9a-zA-Z- ]/i.test(event.key)"
 
 for min and  maxcharacter allowed
 minlength= "4"
  maxlength = "30"