Skip to content

Instantly share code, notes, and snippets.

View gondar00's full-sized avatar
🧘

Gandharv gondar00

🧘
View GitHub Profile
@gondar00
gondar00 / convertKeysToLower.js
Created April 26, 2023 06:46 — forked from radutta/convertKeysToLower.js
Convert JSON Keys to lowercase in Javascript
function keysToLowerCase(obj) {
if(obj instanceof Array) {
for (var i in obj) {
obj[i] = keysToLowerCase(obj[i]);
}
}
if (!typeof(obj) === "object" || typeof(obj) === "string" || typeof(obj) === "number" || typeof(obj) === "boolean") {
return obj;
}
var keys = Object.keys(obj);
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "JSON Schema for Hadolint, a Dockerfile linter tool",
"description": "Dockerfile linter, validate inline bash, written in Haskell",
"type": "object",
"additionalProperties": false,
"properties": {
"ignored": {
"type": "array",
"description": "A list of rules to be ignored",
@gondar00
gondar00 / rest-client.js
Created July 5, 2020 16:47
JS Rest client
class RestClient {
static endpoint = '';
constructor () {
this.id = args.id;
this.errors = Array.isArray(args.errors) ? args.errors : [];
}
static adapter;
@gondar00
gondar00 / http-client.js
Last active July 5, 2020 16:56
http-client
import useSWR from 'swr'
enum HttpVerb {
Get = 'GET',
Post = 'POST',
Put = 'PUT',
Patch = 'PATCH',
Delete = 'DELETE',
}
https://medium.com/better-programming/create-your-own-changelog-generator-with-git-aefda291ea93
@gondar00
gondar00 / difference-between-two-strings.js
Created March 31, 2020 19:41
difference between two strings in javscript
function findDiff(str1, str2){
let diff= "";
str2.split('').forEach(function(val, i){
if (val != str1.charAt(i))
diff += val ;
});
return diff;
}
@gondar00
gondar00 / good-design-websites
Created March 31, 2020 18:42
good design websites
https://www.zinoapp.com/
@gondar00
gondar00 / preserve-cursor-position-react-hooks.js
Created March 25, 2020 22:11
preserve-cursor-position-react-hooks
import * as React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const strip = value => value.replace(/[^a-zA-Z\s]/g, "");
function filterOut(text, cursor) {
const beforeCursor = text.slice(0, cursor);
const afterCursor = text.slice(cursor, text.length);
@gondar00
gondar00 / deploy-static-site-heroku.md
Created March 24, 2020 09:04 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@gondar00
gondar00 / x-seconds.js
Created March 17, 2020 22:16
print every x seconds
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function delayed(current, max) {
console.log(current);
await sleep(current * 1000);
return current > max ? null : delayed(current + 1, max)
}