This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |