Skip to content

Instantly share code, notes, and snippets.

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

indatawetrust

🏠
Working from home
View GitHub Profile

Configure prettier, eslint, husky (pre commit hook), lint-staged in react + typescript project

Steps to configure prettier, eslint, husky (pre commit hook), lint-staged in react + typescript project created using create-react-app. This is opinionated configuration with airbnb's style guide as the base style guide.

Step 1 :: Setup prettier

1.1) Install prettier as dev dependency.

npm install --save-dev --save-exact prettier
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active June 28, 2025 06:58
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

@mikamboo
mikamboo / README.md
Last active April 14, 2025 14:09
JS : Display image in browser console

Function to display image in js console

Source : https://stackoverflow.com/a/47177899

console.image = function(url, size = 100) {
  const image = new Image();
  image.src = url;
  image.onload = function() {
 var style = [
# test directories
__tests__
^(?!@serverless/enterprise-plugin/).*test.*$ # fix for serverless-enterprise
tests
powered-test
*.test.js
*.tap.js
*.test.ts
*tests.html
@tavinus
tavinus / puppeteerDebianHeadless.md
Created September 11, 2020 09:14
Minimal Puppeteer NodeJS Debian 10 Buster

System

Debian 10 Buster headless

Chromium dependencies

Shared Libraries needed

$ sudo apt install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0

Install nvm

Local user

@tomhicks
tomhicks / plink-plonk.js
Last active May 15, 2025 13:25
Listen to your web pages
@AdityaRanjanSingh
AdityaRanjanSingh / mock-aws-sdk.test.js
Last active July 21, 2023 08:08
Mocking aws-sdk in jest
const AWS = require('aws-sdk');
//In the test file
const mockDynamodbGetItem = jest.fn();
const mockS3GetObject = jest.fn();
//mock aws sdk
jest.mock('aws-sdk', () => {
return {
@muratbaskicioglu
muratbaskicioglu / cities.js
Created January 8, 2020 11:29
Türkiye İl & İlçe Listesi
[
'Adana', 'Adıyaman', 'Afyon', 'Ağrı', 'Amasya',
'Ankara', 'Antalya', 'Artvin', 'Aydın', 'Balıkesir',
'Bilecik', 'Bingöl', 'Bitlis', 'Bolu', 'Burdur',
'Bursa', 'Çanakkale', 'Çankırı', 'Çorum', 'Denizli',
'Diyarbakır', 'Edirne', 'Elazığ', 'Erzincan', 'Erzurum',
'Eskişehir', 'Gaziantep', 'Giresun', 'Gümüşhane', 'Hakkari',
'Hatay', 'Isparta', 'İçel (Mersin)', 'İstanbul', 'İzmir',
'Kars', 'Kastamonu', 'Kayseri', 'Kırklareli', 'Kırşehir',
'Kocaeli', 'Konya', 'Kütahya', 'Malatya', 'Manisa',
@abn
abn / slugify.postgres.sql
Last active April 27, 2025 15:50
A slugify function for postgres
-- original source: https://medium.com/adhawk-engineering/using-postgresql-to-generate-slugs-5ec9dd759e88
-- https://www.postgresql.org/docs/9.6/unaccent.html
CREATE EXTENSION IF NOT EXISTS unaccent;
-- create the function in the public schema
CREATE OR REPLACE FUNCTION public.slugify(
v TEXT
) RETURNS TEXT
LANGUAGE plpgsql
@estorgio
estorgio / prettier-eslint-precommit.md
Last active December 17, 2024 10:58
Setting up Prettier and ESLint with pre-commit hook

Setting up Prettier and ESLint with pre-commit hook

  • Initialize Git repository
    git init
  • Create .gitignore file and add the following:
    node_modules/
    *.env