Skip to content

Instantly share code, notes, and snippets.

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

Danilo Gačević gax97

🏠
Working from home
View GitHub Profile
@ClickerMonkey
ClickerMonkey / types.ts
Last active June 18, 2024 17:13
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
@pedrouid
pedrouid / eslint-typescript.md
Last active August 11, 2022 14:31
Eslint + Prettier configuration for Typescript 3.7+ (2020)

Eslint + Prettier configuration for Typescript 3.7+ (2020)

  1. Install required dependencies
npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-prettier eslint-plugin-promise eslint-plugin-react eslint-plugin-standard prettier

# OR

yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-prettier eslint-plugin-promise eslint-plugin-react eslint-plugin-standard prettier
@matheusnascgomes
matheusnascgomes / .eslintrc.js
Last active November 17, 2021 22:19 — forked from diego3g/.eslintrc.js
A basic setup on typescript linter in a React Project
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
},
extends: [
'react-app',
'airbnb',
'plugin:@typescript-eslint/recommended',
@evolkmann
evolkmann / importing.module.ts
Created January 4, 2019 15:34
Create Nest.js modules with custom config
import { Module } from '@nestjs/common';
import { MyLibModule } from './my-lib.module';
@Module({
imports: [
MyLibModule.register({ name: 'Enzo' }),
]
})
export class ImportingModule {}
@jsdario
jsdario / nuke-deps.sh
Last active December 12, 2023 08:36
Script to clean watchman, remove node_modules, clean cache and restart packager for React Native troubleshooting.
#!/bin/bash
# Stop cached listeners
watchman watch-del-all
# Remove installed modules
rm -rf node_modules
# Remove yarn meta files
rm yarn*
@fffaraz
fffaraz / dns.c
Created May 29, 2016 05:58
DNS Query Code in C with linux sockets
//DNS Query Program on Linux
//Author : Silver Moon (m00n.silv3r@gmail.com)
//Dated : 29/4/2009
//Header Files
#include<stdio.h> //printf
#include<string.h> //strlen
#include<stdlib.h> //malloc
#include<sys/socket.h> //you know what this is for
#include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc
@sangeeths
sangeeths / github-to-bitbucket
Created March 10, 2014 15:24
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v