Skip to content

Instantly share code, notes, and snippets.

View HarshitKaushik's full-sized avatar
💭
I may be slow to respond.

Harshit Kaushik HarshitKaushik

💭
I may be slow to respond.
View GitHub Profile
public static String getActivityTime(Date inputDate) {
Date currentDate = new Date();
Long currentTime = new Date().getTime();
Long inputTime = inputDate.getTime();
long timeRemaining = currentTime - inputTime;
long sec = (timeRemaining / 1000) % 60;
long min = (timeRemaining / (1000 * 60)) % 60;
long hours = (timeRemaining / (1000 * 60 * 60)) % 24;
@HarshitKaushik
HarshitKaushik / promises.md
Created June 13, 2018 17:27 — forked from domenic/promises.md
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.