Skip to content

Instantly share code, notes, and snippets.

Pradeep kpradeep12

Block or report user

Report or block kpradeep12

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kpradeep12 / Pizza.kt
Last active Jan 26, 2019
This class will demonstrate the kotlin features along with building a Pizza DSL.
View Pizza.kt
enum class Cheese{Light, Normal, Extra;}
enum class Sauce{Marinara, GarlicParmesan, Alfredo}
interface Topping
enum class Veg: Topping {Onion, Tomato, Pepper, Spinach;}
enum class Meat: Topping {Chicken, Pepperoni;}
fun main() =
pizza {
large {
kpradeep12 /
Created Jan 17, 2019
Generate number, character, strings, boolean and dates for test data using strategy design pattern.
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Random;
interface Generator<T> {
T generate();
static Generator<Boolean> generateBoolean(){
return new Generator<>() {
Random random = new Random();
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class WorldClock {
public static void main(String[] args) {
DateTimeFormatter FORMAT = DateTimeFormatter.ofPattern("E, dd MMM u hh:mm:ss a z");
public class DesktopUtility {
public static void main(String[] args) throws URISyntaxException, IOException {
Desktop desktop = java.awt.Desktop.getDesktop();
// Opens composing window of default mail client
desktop.mail(new URI("mailto:<email address>"));
import j2html.tags.DomContent;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Observable<Integer> observable = Observable.create(observableEmitter -> { // <1>
System.out.println("Generating numbers");
new Random().ints(10, 0, 5) // <2>
.forEach(i -> {
delay(500); // <3>
observableEmitter.onNext(i); // <4>
class Employee{
private Integer id;
private String name;
private Integer age;
Employee(Integer id, String name, Integer age) { = id; = name;
this.age = age;
You can’t perform that action at this time.