Skip to content

Instantly share code, notes, and snippets.

View gaurangrshah's full-sized avatar
💭
🚀

gshah2020 gaurangrshah

💭
🚀
View GitHub Profile
@gaurangrshah
gaurangrshah / .prettierignore
Last active October 10, 2020 05:49
prettier-files
.cache
package.json
package-lock.json
public
@gaurangrshah
gaurangrshah / .gitignore
Last active October 19, 2020 01:07
#node 2020 #gitignore
.DS_Store
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
@gaurangrshah
gaurangrshah / server.js
Created October 14, 2020 01:16
#koa #basic #server
// server.js
const Koa = require("koa");
const Router = require("koa-router");
const bodyParser = require("koa-parser");
const app = new Koa();
const PORT = 4000;
app.listen(PORT);
@gaurangrshah
gaurangrshah / downloadObjectAsJson.js
Created October 16, 2020 18:39
#browser #utils #downloadAsJson
function downloadAsJson(exportObj, exportName){
var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportObj));
var downloadAnchorNode = document.createElement('a');
downloadAnchorNode.setAttribute("href", dataStr);
downloadAnchorNode.setAttribute("download", exportName + ".json");
document.body.appendChild(downloadAnchorNode); // required for firefox
downloadAnchorNode.click();
downloadAnchorNode.remove();
}
@gaurangrshah
gaurangrshah / docker-compose.yml
Created October 19, 2020 02:46
#docker #strapi #mysql #mariadb
version: '3'
services:
api:
depends_on:
- db
image: strapi/strapi
restart: unless-stopped
container_name: strapi
environment:
@gaurangrshah
gaurangrshah / block.json
Last active October 19, 2020 18:05
#strapicomponents #composite
{
"collectionName": "components_composite_blocks",
"info": {
"name": "block",
"icon": "stream"
},
"options": {},
"attributes": {
"text": {
"type": "component",
@gaurangrshah
gaurangrshah / .gitignore
Created October 26, 2020 00:01
#system #default #root #use
############################
# OS X
############################
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
@gaurangrshah
gaurangrshah / regex-validator.js
Last active April 12, 2021 18:57
#utils #validation #js
export const is = {
blank: /^\s*$/,
string: /^[a-zA-Z]+$/,
email: /^[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}$/,
tel: /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/,
specialNumeric: /^(?:[\d,\/().]*[a-zA-Z][a-zA-Z\d,\/().]*)?$/,
streetAddress: /^\d+\s[A-z]+\s[A-z]+/,
stateZip: /([A-Z]{2}) (\d{5})$/,
number: /^\d+$/,
alphaNumeric: /^[a-zA-Z0-9]+$/,
@gaurangrshah
gaurangrshah / launch.json
Created October 30, 2020 16:45
#vscode #debug #gatsby #edge
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch localhost in Microsoft Edge",
"type": "edge",
"request": "launch",
"url": "http://localhost/8000",
"webRoot": "${workspaceFolder}/src"
},
@gaurangrshah
gaurangrshah / index.js
Created November 3, 2020 21:14
#utils #tools
export * from "./react-tools"
export * from "./slugify"
export * from "./tools"
export * from "./truncate"