Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Working Hard

Suraj Mandal surajmandalcell

💪
Working Hard
View GitHub Profile
@surajmandalcell
surajmandalcell / env-backup.sh
Last active Jun 5, 2022
If you maintain your repositories in a single folder grouped by org or such this backs them up, not the most efficient
View env-backup.sh
# Variables
filename='.env-list.txt'
backupdir='~/Documents/backups__/envfiles'
rm -rf $filename
find . -name '*.env' >> $filename
while IFS="" read -r p || [ -n "$p" ]
do
if [[ "._" == *"$p"* ]]; then
@surajmandalcell
surajmandalcell / error.ts
Last active Feb 13, 2022
Angular observable mock & error handling utils to shift from direct api to mock data when developing(for legacy code)
View error.ts
import { HttpErrorResponse } from '@angular/common/http';
import { throwError } from 'rxjs/internal/observable/throwError';
export function errorHandler(error: HttpErrorResponse) {
return throwError(error);
}
@surajmandalcell
surajmandalcell / reqUrl.js
Created Dec 25, 2021 — forked from wilsonpage/reqUrl.js
A function I made that wraps the node http.request function to make it a little more friendly. In my case I am using it for API route testing.
View reqUrl.js
// module dependencies
var http = require('http'),
url = require('url');
/**
* UrlReq - Wraps the http.request function making it nice for unit testing APIs.
*
* @param {string} reqUrl The required url in any form
* @param {object} options An options object (this is optional)
@surajmandalcell
surajmandalcell / amazon-linux-2-docker-compose-install.md
Last active Aug 25, 2021
Install docker and docker-compose in amazon linux 2
View amazon-linux-2-docker-compose-install.md
sudo amazon-linux-extras install -y docker && sudo service docker start && \
sudo usermod -a -G docker ec2-user && \
sudo chkconfig docker on && \
sudo yum install -y git && \
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) \
-o /usr/local/bin/docker-compose && \
sudo chmod +x /usr/local/bin/docker-compose && \
docker-compose version && \
sudo reboot
@surajmandalcell
surajmandalcell / file-upload.tsx
Created May 29, 2021 — forked from Sqvall/file-upload.tsx
File Upload with Chakra UI and react-hook-form
View file-upload.tsx
import { ReactNode, useRef } from 'react'
import { Button, FormControl, FormErrorMessage, FormLabel, Icon, InputGroup } from '@chakra-ui/react'
import { useForm, UseFormRegisterReturn } from 'react-hook-form'
import { FiFile } from 'react-icons/fi'
type FileUploadProps = {
register: UseFormRegisterReturn
accept?: string
multiple?: boolean
children?: ReactNode
View lazy-load-nvm.sh
#!/bin/bash
#
# NVM lazy loading script
#
# NVM takes on average half of a second to load, which is more than whole prezto takes to load.
# This can be noticed when you open a new shell.
# To avoid this, we are creating placeholder function
# for nvm, node, and all the node packages previously installed in the system
# to only load nvm when it is needed.
View submime_text3_settings_mac.txt
{
"color_scheme": "Packages/ayu/ayu-dark.sublime-color-scheme",
"font_face": "Operator Mono Medium",
"font_size": 13,
"hot_exit": true,
"ignored_packages":
[
"Vintage"
],
"open_files_in_new_window": false,
@surajmandalcell
surajmandalcell / name.js
Created Nov 10, 2020 — forked from tkon99/name.js
Random Name Generator for Javascript
View name.js
/*
(c) by Thomas Konings
Random Name Generator for Javascript
*/
function capFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function getRandomInt(min, max) {
View firebaseStorageUppload.jsx
// Copied from https://github.com/lyhd/reactjs/blob/react-firebase-file-upload/src/index.js
import React, { useState } from "react";
import { render } from "react-dom";
import { storage } from "./firebase";
const ReactFirebaseFileUpload = () => {
const [image, setImage] = useState(null);
const [url, setUrl] = useState("");
const [progress, setProgress] = useState(0);
@surajmandalcell
surajmandalcell / gist:30a162fa7a1f2dfd04315e6b25d1e4f2
Last active Apr 30, 2020
List of free courses during covid-19
View gist:30a162fa7a1f2dfd04315e6b25d1e4f2
1. Google Courses: https://learndigital.withgoogle.com/d...
2. UX Design Masterclass: https://uxdesignmasterclass.com ( Code: CARE )
3. Pluralsight: https://app.pluralsight.com
4. Open Learn: https://www.open.edu/openlearn
5. Great Learning: https://www.greatlearning.in/academy