Skip to content

Instantly share code, notes, and snippets.

@bchetty
bchetty / java.gitignore
Created December 26, 2017 19:36
gitignore file for Java projects
#---------------------------------------#
# Project Ignores #
#---------------------------------------#
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
@bchetty
bchetty / Inception.java
Created April 24, 2014 20:48
Java - Recursion Depth
**
* Inception
*
* @author Babji, Chetty
*/
public class Inception {
public static void main(String[] args) {
Inception inception = new Inception();
inception.dream(0);
}
@bchetty
bchetty / EulersNumber.java
Last active July 1, 2016 13:17
Google Billboard Puzzle
import java.math.BigDecimal;
import java.math.MathContext;
public class EulersNumber {
public static void main(String[] args) {
BigDecimal e = BigDecimal.ONE;
BigDecimal bigDecimal = BigDecimal.ONE;
for(int i=1;i<100;i++) {
bigDecimal = bigDecimal.multiply(new BigDecimal(i * 1.0 + ""));
import hudson.model.*
// For each project
for(item in Hudson.instance.items) {
// check that job is not building
if(!item.isBuilding()) {
println("Wiping out workspace of job "+item.name)
item.doDoWipeOutWorkspace()
}
else {
println("Skipping job "+item.name+", currently building")
@bchetty
bchetty / BS3-MediaQueries-Template.css
Created May 24, 2016 16:49
BS3 MediaQueries Template
/* Large desktops and laptops */
@media (min-width: 1200px) {
}
/* Landscape tablets and medium desktops */
@media (min-width: 992px) and (max-width: 1199px) {
}
@bchetty
bchetty / MathApp.java
Last active March 25, 2016 22:55
Guice Grapher Class
package com.chetty.client;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import com.chetty.module.MathModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.grapher.GrapherModule;
@bchetty
bchetty / PQTest.java
Last active March 25, 2016 22:19
PQTest.java
import java.util.Comparator;
import java.util.PriorityQueue;
/**
*
* @author Babji P, Chetty
*/
public class PQTest {
public static void main(String[] args) {
PriorityQueue<Integer> pQueue = new PriorityQueue<Integer>(10, new Comparator<Integer>() {
@bchetty
bchetty / PQueueTest.java
Created March 25, 2016 22:15
PQueueTest.java
import com.chetty.algos.data.Patient;
import java.util.Comparator;
import java.util.PriorityQueue;
/**
*
* @author Babji Prashanth, Chetty
*/
public class PQueueTest {
public static void main(String[] args) {
@bchetty
bchetty / Patient.java
Created March 25, 2016 22:11
Patient Model Class
/**
*
* @author Babji P, Chetty
*/
public class Patient {
private int id;
private String name;
private boolean emergencyCase;
public Patient(int id, String name, boolean emergencyCase) {