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 / 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 "[email protected]"
@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);
@smitpatelx
smitpatelx / object-to-form-data.js
Created April 6, 2021 21:31 — forked from ghinda/object-to-form-data.js
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@smitpatelx
smitpatelx / Dockerfile
Created March 3, 2021 21:02 — forked from ricog/Dockerfile
Docker wait for mysql to be ready and then load sql
FROM mysql:5.6
MAINTAINER Your Name <[email protected]>
COPY wait-for-mysql.sh /
CMD /wait-for-mysql.sh