Skip to content

Instantly share code, notes, and snippets.

View kishore-devaraj's full-sized avatar
⚒️
Building...

Kishore Devaraj kishore-devaraj

⚒️
Building...
View GitHub Profile
@kishore-devaraj
kishore-devaraj / msconvert.js
Created March 10, 2018 20:41 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
@kishore-devaraj
kishore-devaraj / Java8DateTimeExamples.java
Created February 21, 2018 05:56 — forked from mscharhag/Java8DateTimeExamples.java
Examples for using the Java 8 Date and Time API (JSR 310)
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import static java.time.temporal.TemporalAdjusters.*;
public class Java8DateTimeExamples {
@kishore-devaraj
kishore-devaraj / observer_design.py
Created November 25, 2017 18:17
Observer Design Pattern Template
# Observer Design Pattern is mainly used in scenarios when there is a change in the Class attributes
# which should be reflected to all of its objects. This technique is explained with the help of Podcast
# example. Here whenever new podcast is uploaded, it should notify all the subscribers.
class Podcast(object):
def __init__(self,subscriber_name):
self.subscriber_name = subscriber_name
def get_podcast(self):
return self._podcasts
def add_podcast(self,podcast_name):