Skip to content

Instantly share code, notes, and snippets.

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

Ahmet Simsek 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
# 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 July 22, 2024 09:51
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 May 29, 2024 13:44
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 April 21, 2024 09:52
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
    
@holmberd
holmberd / aws-s3-bucket-ls-date.md
Created July 15, 2019 16:57
AWS S3 Bucket - List records by date

AWS S3 Bucket - List files by date

With s3 ls

ls-s3.sh:

#!/bin/bash
DATE=$1 || $(date +%Y-%m-%d)
echo "List records for date $DATE"
aws s3 ls s3://bucket-name/directory/ | grep ${DATE}
@evert0n
evert0n / react-app-s3-sync.sh
Created June 11, 2019 11:47 — forked from kevindice/react-app-s3-sync.sh
A shell script for uploading a React app build to S3 + CloudFront for deployment
#!/bin/bash
S3_BUCKET_NAME=$1
CF_ID=$2
# Sync all files except for service-worker and index
echo "Uploading files to $S3_BUCKET_NAME..."
aws s3 sync build s3://$S3_BUCKET_NAME/ \
--acl public-read \
--exclude service-worker.js \