Skip to content

Instantly share code, notes, and snippets.

View jozsefDevs's full-sized avatar
🏠
Working from home

jozsefDevs

🏠
Working from home
  • Budapest / Hungary
View GitHub Profile
@rluvaton
rluvaton / README.md
Last active October 27, 2022 07:04
queryBy vs toBeInTheDocument and getBy* in @testing-library/react

queryBy* and toBeInTheDocument vs getBy*

queryBy* and toBeInTheDocument

Test:

it('should render the component and contain the shot.name', () => {
  // Arrange
  const shot: ShotTitleProps = {
    name: faker.name.title(),
@sangramthecoder
sangramthecoder / create-react-library.zsh
Created February 23, 2021 06:58
Create React Library with Simple zsh script
#!/bin/zsh
function jsonValue() {
KEY=$1
num=$2
awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p
}
echo "Creating directory " $1
mkdir $1
cd $1
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");