For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//note: month is 0 based, just like Dates in js | |
function getWeeksInMonth(year, month) { | |
const weeks = [], | |
firstDate = new Date(year, month, 1), | |
lastDate = new Date(year, month + 1, 0), | |
numDays = lastDate.getDate(); | |
let dayOfWeekCounter = firstDate.getDay(); | |
for (let date = 1; date <= numDays; date++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** Base class for generic event handling. | |
* @example | |
* | |
* // Don’t forget to call `super()` if defining a constructor. | |
* class Foo extends Eventable {} | |
* let foo = new Foo(); | |
* | |
* foo.on('bar', (data) => console.log(data)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy from response here https://stackoverflow.com/a/55189448. ALL CREDITS TO THE ORIGINAL AUTHOR https://stackoverflow.com/users/79247/retsam | |
// the only reason this gist exists is to not lose the content in case of question / answer deletion from stackoverflow | |
const useEffectDebugger = (func, inputs, prefix = "useEffect") => { | |
// Using a ref to hold the inputs from the previous run (or same run for initial run | |
const oldInputsRef = useRef(inputs); | |
useEffect(() => { | |
// Get the old inputs | |
const oldInputs = oldInputsRef.current; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stateInitialDictionary = [ | |
'AB' => 'Alba', | |
'AR' => 'Arad', | |
'AG' => 'Arges', | |
'BC' => 'Bacau', | |
'BH' => 'Bihor', | |
'BN' => 'Bistrita-Nasaud', | |
'BT' => 'Botosani', | |
'BR' => 'Braila', | |
'BV' => 'Brasov', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from 'react'; | |
import Fuse from 'fuse.js'; | |
const DEFAULT_OPTIONS: IUseMemorySearch<any> = { | |
minSearchLength: 3, | |
transformCallback: results => results.map(({ item }) => item), | |
searchOptions: { | |
useExtendedSearch: true, | |
threshold: 0.3, | |
keys: ['title'], |