Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Let's make something better

Vinod Chauhan vinodchauhan7

💭
Let's make something better
View GitHub Profile
@vinodchauhan7
vinodchauhan7 / eslint.json
Created Jan 17, 2021
eslint configuration
View eslint.json
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"extends": [
"plugin:@typescript-eslint/recommended",
"favoritemedium-typescript/config/react"
],
@vinodchauhan7
vinodchauhan7 / index.ts
Created Jan 17, 2021
Radio Button with materia UI
View index.ts
import { Button, Radio } from '@material-ui/core';
function renderOptions(): ReactElement[] {
const options: ReactElement[] = [];
for (let i = 0; i < 4; i += 1) {
const label = i === 0 ? translate('none') : `${i} ${i === 1 ? translate('time') : translate('times')}`;
options.push(
<Button
className={clsx(styles.card, { [styles.selected]: enteritisCount === i })}
key={`option-${i}`}
@vinodchauhan7
vinodchauhan7 / Using of Progress
Created Jan 17, 2021
Progress Line in Typescript with material UI
View Using of Progress
<Progress
current={questionIdx + 1}
total={questions.length}
/>
View Rest Api
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const router = new Router();
router.get("/", (context : any) => {
context.response.body = "Hello world!";
});
//getUser
View addUser
router.post("/addUser",(context : any) => {
try{
const decoder = new TextDecoder("utf-8");
const data = Deno.readFileSync("./users.json");
console.log(decoder.decode(data));
const users = JSON.parse(decoder.decode(data));
console.log(Object.keys(users).length);
var len = Object.keys(users).length;
var user :any = {
"name":"New User",
View gist:844f081631ef009ef236c31c5bff128e
router.get("/getUser/:id",(context : any) => {
try{
const decoder = new TextDecoder("utf-8");
const data = Deno.readFileSync("./users.json");
console.log(decoder.decode(data));
const users = JSON.parse(decoder.decode(data));
if (context.params && context.params.id && users["user"+context.params.id])
{
const user = users["user"+context.params.id];
context.response.body = user;
View app.js
import React, { useEffect, useRef, useState } from "react";
import {
select,
line,
curveCardinal,
scaleLinear,
axisBottom,
axisRight
} from "d3";
import "./App.css";
View Postgresql Data
TRUNCATE TABLE users,posts,comments,favorites,friends RESTART IDENTITY;
insert into users (first_name,last_name,age,email) values ('Kevon','Lebsack',36,'Daniela.Lindgren42@gmail.com');
insert into users (first_name,last_name,age,email) values ('Vada','Waelchi',51,'Zita.Bradtke78@hotmail.com');
insert into users (first_name,last_name,age,email) values ('Virgil','Friesen',63,'Lizzie.Huels2@yahoo.com');
insert into users (first_name,last_name,age,email) values ('Jerrell','Bode',20,'Reyna.Blanda@yahoo.com');
insert into users (first_name,last_name,age,email) values ('Murray','Murray',85,'Joany.Kuhlman@gmail.com');
insert into users (first_name,last_name,age,email) values ('Carolyn','Pacocha',19,'Mohammad_Bergnaum@yahoo.com');
insert into users (first_name,last_name,age,email) values ('Rowena','Rodriguez',36,'Vincenzo.Bartell@yahoo.com');
insert into users (first_name,last_name,age,email) values ('Jordan','Schneider',18,'Eryn.Olson23@hotmail.com');
insert into users (first_name,last_name,age,email) values ('Camyll
View index.scss
$primary: orange;
$danger: black;
@import "~bootstrap/scss/bootstrap";
body {
color: white;
background: teal;
}
View webpack.config.js
const path = require("path");
module.exports = {
mode: "development",
devtool: "none",
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "main.js"
}
};