Skip to content

Instantly share code, notes, and snippets.

View schadokar's full-sized avatar
😵

Shubham Chadokar schadokar

😵
View GitHub Profile
@schadokar
schadokar / quicksort.go
Created March 3, 2020 05:32
Quicksort Implementation in golang
/**
* ********************************** Quick Sort ***********************************************
* UNSORTED ARRAY [3, 7, 8, 5, 2, 1, 9, 6, 4]
* pivot ^
* pivot: 3 arr: [ 2, 1, 3, 5, 8, 7, 9, 6, 4 ]
* [2, 1] [5, 8, 7, 9, 6, 4 ]
* pivot ^ ^
* pivot: 2 arr: [ 1, 2 ]
* pivot: 5 arr: [ 4, 5, 7, 9, 6, 8 ]
* [ 4] [7, 9, 6, 8 ] --> Array with single element is sorted
@schadokar
schadokar / client.js
Last active February 8, 2020 11:53
Fabric Sample balance transfer client for the couchdb wallet
'use strict';
var log4js = require('log4js');
var logger = log4js.getLogger('Helper');
logger.setLevel('DEBUG');
var path = require('path');
var util = require('util');
var hfc = require('fabric-client');
hfc.setLogger(logger);
@schadokar
schadokar / quicksort.js
Last active March 3, 2020 05:31
Quicksort implementation in js
/**
* ********************************** Quick Sort ***********************************************
* UNSORTED ARRAY [3, 7, 8, 5, 2, 1, 9, 6, 4]
* pivot ^
* pivot: 3 arr: [ 2, 1, 3, 5, 8, 7, 9, 6, 4 ]
* [2, 1] [5, 8, 7, 9, 6, 4 ]
* pivot ^ ^
* pivot: 2 arr: [ 1, 2 ]
* pivot: 5 arr: [ 4, 5, 7, 9, 6, 8 ]
* [ 4] [7, 9, 6, 8 ] --> Array with single element is sorted
@schadokar
schadokar / mergesort.js
Created January 9, 2020 13:13
Merge Sort Algorithm in javascript
/**
* ************************************************ MERGE SORT *****************************************************
*
* [38, 27, 43, 3, 9, 82, 10, 900, 78, 80, 11]
* / \
* [38, 27, 43, 3, 9, 82] [10, 900, 78, 80, 11]
* / \ / \
* [38, 27, 43] [3, 9, 82] [10, 900, 78] [ 80, 11 ]
* / \ / \ / \ / \
* [38, 27] [ 43 ] [3, 9] [ 82 ] [10, 900] [ 78 ] [ 80 ] [ 11 ]
@schadokar
schadokar / pee.js
Created August 5, 2019 11:20
track your effective hours
const pee = (effHrs, effMins, lastInHrs, lastInMins, avgHrs, avgMins) => {
let totalEffMins = effHrs * 60 + effMins;
let avg = avgHrs * 60 + avgMins;
let diffInMins;
let leaveHrs;
let leaveMins;
const currentTime = new Date().toLocaleTimeString({
timeZone: "Asia/Kolkata"
});
@schadokar
schadokar / time-in.js
Last active August 5, 2019 11:21
time-in
const peeTimeCalculator = (
currentEffHr,
currentEffMins,
lastInHr,
lastInMins,
avgHrs = 7,
avgMins = 0
) => {
let totalMins = currentEffHr * 60 + currentEffMins;
let lastLogin = lastInHr * 60 + lastInMins;
@schadokar
schadokar / to-do-list.js
Created July 25, 2019 15:59
go-to-do to-do-list component
import React, { Component } from "react";
import axios from "axios";
import { Card, Header, Form, Input, Icon } from "semantic-ui-react";
let endpoint = "http://localhost:8080";
class ToDoList extends Component {
constructor(props) {
super(props);
@schadokar
schadokar / router.go
Created July 23, 2019 17:27
go-todo router
package router
import (
"../middleware"
"github.com/gorilla/mux"
)
// Router is exported and used in main.go
func Router() *mux.Router {
@schadokar
schadokar / middleware.go
Created July 23, 2019 15:46
go-todo middleware
package middleware
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"../models"
@schadokar
schadokar / App.css
Created April 20, 2019 14:28
docker-ethereum
/*
Styles from this codepen:
https://codepen.io/official_naveen/pen/rgknI
*/
body {