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.util.Arrays; | |
import java.util.Comparator; | |
import java.util.function.Consumer; | |
import java.util.function.Supplier; | |
public class Main { | |
private static void sort(String[] strings, Comparator comp) { | |
Arrays.sort(strings, comp); | |
} |
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
@Grab(group = 'com.gmongo', module = 'gmongo', version = '0.8') | |
import com.gmongo.GMongo | |
class MongoTest { | |
static void main(String[] args) { | |
// Instantiate a com.gmongo.GMongo object instead of com.mongodb.Mongo | |
// The same constructors and methods are available here | |
def mongo = new GMongo() | |
// Get a db reference in the old fashion way | |
def db = mongo.getDB("gmongo") |
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
/** | |
* Get disjunction (opposite of intersection) from two lists. | |
* @param a List | |
* @param b List | |
* @return List | |
*/ | |
private List disjunct(List a, List b) { | |
(a + b) - a.intersect(b) | |
} |
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
--- php-fpm.orig 2012-10-02 12:53:02.000000000 +0200 | |
+++ php-fpm 2012-10-02 13:16:40.000000000 +0200 | |
@@ -10,6 +10,8 @@ | |
# | |
# Add the following line to /etc/rc.conf to enable php-fpm: | |
# php_fpm_enable="YES" | |
+# You can also supply flags to start php-fpm: | |
+# php_fpm_flags="-c /usr/local/etc/php.ini" | |
# | |
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
@Override | |
public int hashCode() { | |
int result = username.hashCode(); | |
result = 31 * result + (emailAddress != null ? emailAddress.hashCode() : 0); | |
return result; | |
} |
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
@Override | |
public boolean equals(Object o) { | |
if (this == o) return true; | |
if (o == null || getClass() != o.getClass()) return false; | |
OdiseeUser that = (OdiseeUser) o; | |
if (emailAddress != null ? !emailAddress.equals(that.emailAddress) : that.emailAddress != null) return false; | |
if (id != null ? !id.equals(that.id) : that.id != null) return false; | |
if (!username.equals(that.username)) return false; |
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 static void main(String[] args) { | |
User user1 = new User(); | |
System.out.println(user1); | |
User user2 = new User(); | |
System.out.println(user2); | |
} |
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.faces.component.UIComponent; | |
import javax.faces.context.FacesContext; | |
import javax.faces.convert.Converter; | |
import javax.faces.convert.FacesConverter; | |
@FacesConverter("recipient") | |
public class RecipientConverter implements Converter { | |
@Override | |
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) { |
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.util.Calendar; | |
public class User { | |
private Long id; | |
private Long version; | |
private Calendar lastModified; | |
private String username; | |
private String emailAddress; |
NewerOlder