Skip to content

Instantly share code, notes, and snippets.

@harshitsinghai77
harshitsinghai77 / app.js
Created December 23, 2019 14:10
GitHub Organization API: Get the number of stars for a github organization repository using Node.js
// Basic Routes libraries
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const cors = require('cors');
const axios = require('axios');
//Logging
const pino = require('pino')("./logs/info.log");;
const expressPino = require("express-pino-logger")({
@harshitsinghai77
harshitsinghai77 / debounce-axios-cancelToken.js
Created January 22, 2020 07:25
Debounce-Axios-CancelToken-React
import React from "react";
// import { Link } from "react-router-dom";
import PlantIcon from '../../images/plant_icon.svg'
import EyeIcon from '../../images/eye_icon.svg'
//import { Row, InputNumber, Slider, Typography } from "antd";
import './Page3.scss';
import { Tag , Typography } from "antd";
import { Button, CircularProgress } from '@material-ui/core';
import axios from 'axios';
import _ from 'lodash';
@harshitsinghai77
harshitsinghai77 / Vagrantfile
Created February 23, 2020 02:26
Vagrant Discourse Configuration
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
class Decimal:
def __init__(self, number, places):
self.number = number
self.places = places
def __repr__(self):
return "%.{}f".format(self.places) % self.number
class Currency(Decimal):
class ClassA():
def hi(self):
print("Hey")
class ClassB():
def hi(self):
print("Hello")
def another_method(self):
@harshitsinghai77
harshitsinghai77 / async-await-python-without-asyncio.py
Created October 11, 2020 15:09
A simple python programme to demonstrate some heavy calculation inside the function.
import time
import datetime
start = datetime.datetime.now()
def two():
print("Starting two")
time.sleep(4)
print("Hey two")

Harshit Singhai User Manual

This is my user manual. If we are working together (or planning to), please read it carefully. You will learn how to deal with me productively and avoid misunderstandings.

My style

  • I need to understand why I'm doing something
  • I love working as a part of a team, not as an individual
  • I love pair programming
  • I like to have a very basic working version first and iterate on it
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/mattn/go-sqlite3"
)
@harshitsinghai77
harshitsinghai77 / models.go
Created November 4, 2020 08:29
Go models.go file using go-sqlite3
package dbutils
const clubs = `
CREATE TABLE IF NOT EXISTS clubs (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
NAME VARCHAR(64) NOT NULL,
COUNTRY VARCHAR(64) NOT NULL,
STADIUM VARCHAR(64) NOT NULL,
CreatedAt TIME NULL
)
package dbutils
import (
"database/sql"
"log"
)
// Initialize the database and create required table
func Initialize(dbDriver *sql.DB) {
statement, driverError := dbDriver.Prepare(clubs)