Skip to content

Instantly share code, notes, and snippets.

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):
@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
@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 / 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")({