Skip to content

Instantly share code, notes, and snippets.

View smitpatelx's full-sized avatar
🎯
Focusing

Smit Patel smitpatelx

🎯
Focusing
View GitHub Profile
@smitpatelx
smitpatelx / es5.js
Created February 16, 2024 03:30 — forked from danieliser/es5.js
Convert Hex Color to rgba with opacity
/**
* ECMA2015
*/
function convertHex(hexCode, opacity = 1){
var hex = hexCode.replace('#', '');
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
@smitpatelx
smitpatelx / tmux-cheatsheet.markdown
Created January 15, 2024 07:36 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
data:
redis.conf: |
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
@smitpatelx
smitpatelx / vscode-macos-context-menu.md
Created June 8, 2023 00:44 — forked from idleberg/vscode-macos-context-menu.md
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
@smitpatelx
smitpatelx / US_States_and_Cities.json
Created November 9, 2022 19:52 — forked from ahmu83/US_States_and_Cities.json
List of US States and Cities in JSON format.
{
"New York": [
"New York",
"Buffalo",
"Rochester",
"Yonkers",
"Syracuse",
"Albany",
"New Rochelle",
"Mount Vernon",
@smitpatelx
smitpatelx / Flutter Clean.md
Created April 17, 2022 09:47 — forked from minhcasi/Flutter Clean.md
These are common issues on Flutter and solutions to fix

Quick Clean Cache

  1. Open android studio Tools->Flutter->Clean
  2. Go to File -> Invalidate Caches / Restart
  3. Or open terminal run "flutter clean"
  4. Remove pubspec.lock
  5. Double check the Flutter SDK Path config correcty - https://tppr.me/qn6dP

Or open the terminal and try this script:

flutter clean
@smitpatelx
smitpatelx / .eslintrc.json
Created March 8, 2022 20:05
Eslint JSON configuration
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2020
},
@smitpatelx
smitpatelx / multiple_ssh_setting.md
Last active November 5, 2021 14:37 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@smitpatelx
smitpatelx / jwt-test-nestjs.ts
Last active May 24, 2021 18:28
Nest.js end-to-end test for JWT auth
import { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import * as request from 'supertest';
import { AppModule } from '../src/app.module';
import { AppService } from '../src/app.service';
import { UserModule } from '../src/users/users.module';
import { UsersService } from '../src/users/users.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserEntity } from '../src/models/users/user.entity';
@smitpatelx
smitpatelx / distance_between_geopoints.js
Created April 27, 2021 23:32 — forked from barinbritva/distance_between_geopoints.js
Detect distance between geo points.
function deg2rad (angle) {
return angle * .017453292519943295;
}
function distance($lat1,$lng1,$lat2,$lng2)
{
$lat1=deg2rad($lat1);
$lng1=deg2rad($lng1);
$lat2=deg2rad($lat2);
$lng2=deg2rad($lng2);