Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rahulbanerjee26's full-sized avatar

Rahul Banerjee rahulbanerjee26

View GitHub Profile
const add =
(a, b) => a + b
const subtract =
(a, b) => a - b
const multiply =
(a, b) => a * b
const divide =
(a, b) => a / b
module.exports = {
add,subtract,multiply,divide
const {add,
subtract,
divide,
multiply} = require('./utils')
module.exports = {add,subtract, divide, multiply}
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged && npm run lint && npm test"
}
}
const {
add, subtract, divide, multiply,
} = require('.');
assert = require('chai').assert;
describe('Sum', () => {
context('Adding 1 and 1', () => {
it('should return 2', () => {
assert(add(1, 1) === 2);
});
function LoadBackground() {
const [isLoading, setIsLoading] = React.useState(true);
const [data, setData] = React.useState([]);
React.useEffect(() => {
const url = "https://randomuser.me/api/?results=15";
fetch(url)
.then((response) => response.json())
.then((json) => setData(json['results']))
.catch((error) => console.log(error));
import React from "react";
function ButtonLoad() {
const [isLoadingData, setisLoadingData] = React.useState(false);
const [data, setData] = React.useState([]);
const [showData, setShowData] = React.useState(false);
const handleClick = () => {
setisLoadingData(true);
setShowData(true)
@app.route('/githubIssue',methods=['POST'])
def githubIssue():
data = request.json
print(f'Issue {data["issue"]["title"]} {data["action"]}')
print(f'{data["issue"]["body"]}')
print(f'{data["issue"]["url"]}')
return data
from flask import Flask,request,json
app = Flask(__name__)
@app.route('/')
def hello():
return 'Webhooks with Python'
if __name__ == '__main__':
app.run(debug=True)
@rahulbanerjee26
rahulbanerjee26 / __init__.py
Created November 8, 2021 21:24
InfluxDB Tutorial
from datetime import datetime
from dotenv import load_dotenv, main
import os
from influxdb_client import InfluxDBClient, Point, WritePrecision
from influxdb_client.client.write_api import SYNCHRONOUS
load_dotenv()
# You can generate a Token from the "Tokens Tab" in the UI
token = os.getenv('TOKEN')
org = os.getenv('ORG')
@rahulbanerjee26
rahulbanerjee26 / __init__.py
Created November 9, 2021 20:51
InlfuxDb Class Init Method
class InfluxClient:
def __init__(self,token,org,bucket):
self._org=org
self._bucket = bucket
self._client = InfluxDBClient(url="http://localhost:8086", token=token)