Skip to content

Instantly share code, notes, and snippets.

View corocoto's full-sized avatar
👨‍💻
creates something cool

Artem Gusev corocoto

👨‍💻
creates something cool
View GitHub Profile
@Danetag
Danetag / useMyAwesomeHook.specs.tsx
Last active October 11, 2024 15:30
Testing a React hook with a redux store
import React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import stateFactory from 'jest/stateFactory';
import configureMockStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import { Store, AnyAction } from 'redux';
import { initialState as initialPaginationState } from '../../store/pagination/reducer';
import { useMyAwesomeHook } from '../useMyAwesomeHook';
@tkadlec
tkadlec / perf-diagnostics.css
Last active August 17, 2024 19:33
CSS used to highlight potential performance issues
:root {
--violation-color: red; /* used for clear issues */
--warning-color: orange; /* used for potential issues we should look into */
}
/* IMAGES */
/*
* Lazy-Loaded Images Check
* ====
@GGrassiant
GGrassiant / A. useResize.md
Created September 19, 2020 19:45
useResize

useResize custom hook.

Custom hook as per Sophie Alpert on StackOverflow function that returns the height and width on each update of the window

@customcommander
customcommander / spread-vs-assign.md
Last active December 18, 2023 11:13
On using assignment over spread to achieve performance

Spread vs assign

Abstract

In this article I compare the performance of the spread operator ... and the performance of the assignement operator = in the context of data transformation.

I show that using the spread operator isn't a trivial choice to make and I suggest that immutability and mutation don't have to be mutually exclusive. I also show how one-liner functions can be enriched with the comma operator ,.

What are we measuring?

@justincy
justincy / README.md
Last active April 5, 2024 22:19
Configure Storybook to work with Next.js, TypeScript, and CSS Modules

In addition to the Storybook for React setup, you'll also need to install these packages:

npm i -D @babel/core babel-loader css-loader style-loader
@pylnata
pylnata / RecipeItem.js
Last active April 3, 2023 02:59
Jest+Enzyme example unit test with SHALLOW for React component using useEffect and (useDispatch, useSelector) hooks
import React from "react";
export const Recipeitem = (props) => {
return (<div>
{props.title}
</div>)
}
@pedrouid
pedrouid / webcrypto-examples.md
Created December 15, 2018 01:07
Web Cryptography API Examples
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active November 14, 2024 06:21
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active October 12, 2024 17:22
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
// POLYFILLS
// Event.composedPath
// Possibly normalize to add window to Safari's chain, as it does not?
(function(E, d, w) {
if(!E.composedPath) {
E.composedPath = function() {
if (this.path) {
return this.path;
}
var target = this.target;