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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Google Mapathon 2013</title> | |
<meta content="en" http-equiv="content-language"> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false&language=en&key=AIzaSyDZ82d3j-OqU8JHoU8JSAz-gJFty9ERrao"></script> | |
<script type="text/javascript"> |
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
#!/usr/bin/perl | |
# | |
# Pre-commit hook for running checkstyle on changed Java sources | |
# | |
# To use this you need: | |
# 1. checkstyle's jar file somewhere | |
# 2. a checkstyle XML check file somewhere | |
# 3. To configure git: | |
# * git config --add checkstyle.jar <location of jar> | |
# * git config --add checkstyle.checkfile <location of checkfile> |
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
public class Customer { | |
// No setter method | |
private final List<Order> orders; | |
public List<Order> getOrders() { return orders; } | |
public Customer(...) {...} | |
} |
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
package functions; | |
import java.awt.*; | |
import java.awt.event.*; | |
class HelloButtonApp2 { | |
private final Button button = new Button(); | |
} | |
public HelloButtonApp2() { | |
button.addActionListener(new ActionListener() { | |
public void actionPerformed(ActionEvent e) { | |
System.out.println("Hello There: event received: " + e); |
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
package functions; | |
public interface Function1Void<A> { | |
void apply(A a); | |
} | |
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
public FunctionalHelloButtonApp() { | |
button.addActionListener( | |
#{ ActionEvent e -> System.out.println("Hello There: event received: "+e) } | |
); | |
} |
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
package functions; | |
import static org.junit.Assert.*; | |
import org.junit.Test; | |
public class RecursionTest { | |
static class Tree { | |
// public fields for simplicity | |
public final Tree left; // left subtree | |
public final Tree right; // right subtree | |
public final int value; // value at this node | |
public Tree(Tree left, int value, Tree right) { |
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
package math; | |
import static datastructures2.ListModule.*; | |
public class NaturalNumbers { | |
public static final int ZERO = 0; | |
public static int next(int previous) { return previous + 1; } | |
public static List<Integer> take(int count) { | |
return doTake(emptyList(), count); | |
} | |
private static List<Integer> doTake(List<Integer> accumulator, int count) { | |
if (count == ZERO) |
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
package math; | |
public class Factorial { | |
public static long declarativeFactorial(int n) { | |
assert n > 0 : "Argument must be greater than 0"; | |
if (n == 1) return 1; | |
else return n * declarativeFactorial(n-1); | |
} | |
public static long imperativeFactorial(int n) { | |
assert n > 0 : "Argument must be greater than 0"; | |
long result = 1; |
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
package option; | |
public final class None<T> extends Option<T> { | |
public static class NoneHasNoValue extends RuntimeException {} | |
public None() {} | |
public boolean hasValue() { return false; } | |
public T get() { throw new NoneHasNoValue(); } | |
@Override | |
public String toString() { return "None"; } | |
@Override | |
public boolean equals(Object other) { |
OlderNewer