//Smart use of enums
public enum DeviceComparator implements Comparator<Device> {
ID {
public int compare(Device o1, Device o2) {
return Integer.valueOf(o1.getId()).compareTo(o2.getId());
}},
NAME {
public int compare(Device o1, Device o2) {
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
// Conventions: | |
// We use angles in degrees in clock-wise fashion | |
RobotHelpers = {}; | |
MathHelpers = {}; | |
RobotHelpers.cannon_rotation_direction = {}; | |
RobotHelpers.shoot = {}; | |
RobotHelpers.target = {}; | |
RobotHelpers.moving_direction = {}; |
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
// Conventions: | |
// We use angles in degrees in clock-wise fashion | |
RobotHelpers = {}; | |
MathHelpers = {}; | |
RobotHelpers.cannon_rotation_direction = {}; | |
RobotHelpers.shoot = {}; | |
RobotHelpers.target = {}; | |
RobotHelpers.moving_direction = {}; |
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
#!/bin/bash | |
# This script is edited by Brice Dutheil | |
# See there in french http://blog.arkey.fr/2012/07/30/script-pour-installer-le-jdk-5-sur-macosx-lion/ | |
# Translate button is broken for now, please use Google to translate this website. | |
# | |
# 2012/08/25 This script didn't behave correctly when ran on 10.8.1 | |
# Added recommendation to always run this script after updates such as Java, XCode, OSX, etc. | |
# | |
# 2O12/07/29 Added Mountain Lion support => Choose the 64bit JVM ! |
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 javax.swing.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class JCheckBoxActionListener { | |
public static void main(String args[]) { | |
JFrame frame = new JFrame("Iconizing CheckBox"); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
JCheckBox aCheckBox4 = new JCheckBox("Stuffed Crust"); |
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 facebook; | |
import java.util.HashSet; | |
import java.util.Set; | |
/** | |
* The complexity of that algorithm is O(n^m), where: | |
* n - the length of a string. | |
* m - number of permutations. | |
*/ |
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
# ~/.bash_aliases | |
# Kill all running containers. | |
alias dockerkillall='docker kill $(docker ps -q)' | |
# Delete all stopped containers. | |
alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)' | |
# Delete all untagged images. | |
alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)' |
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 main | |
import ( | |
"io/ioutil" | |
"log" | |
"net/http" | |
"time" | |
"io" | |
"flag" | |
"strconv" |
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 main | |
import ( | |
"net/http" | |
"github.com/gorilla/handlers" | |
"os" | |
) | |
func main() { | |
http.ListenAndServe(":8080", handlers.CombinedLoggingHandler(os.Stdout, http.FileServer(http.Dir("/tmp/")))) |
OlderNewer