Skip to content

Instantly share code, notes, and snippets.

View krisskross's full-sized avatar

Christofer Sjögren krisskross

View GitHub Profile
// 1, 2, 3 is easy
List<Integer> counting = Arrays.asList(1, 2, 3);
// mathematical variable
Double x;
// measuring performance
TimeUnit precision = TimeUnit.NANOSECONDS;
// 5:01 developers
Set<Day> working = new HashSet<Day>(Arrays.asList(MON, TUE, WED, THU, FRI));
// content tags
List<String> labels;
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@Config @NotNull @Size(min=1, max=5)
List<Person> persons;
@Config @NotNull @Size(min=8, max=25)
BeanId deployerRoleId = BeanId.create("deployer", Role.class.getName());
Bean deployer = Bean.create(deployerRoleId);
BeanId assemblerRoleId = BeanId.create("assembler", Role.class.getName());
Bean assembler = Bean.create(assemblerRoleId);
BeanId adminRoleId = BeanId.create("administrator", Role.class.getName());
Bean adminRole = Bean.create(adminRoleId);
adminRole.addReference("roles", deployerRoleId);
adminRole.addReference("roles", assemblerRoleId);
@Config(desc = "An individual (or application program) identity")
public class User {
@Id(desc = "username")
private String username;
@Config(desc = "password")
private String password;
@Config(desc = "Roles assigned to this user")
private Set<Role> roles = new HashSet<Role>();
@Config(desc = "A binary tree")
@BinaryTreeConstraint
public class BinaryTree {
@Id(desc = "id of current node")
private String id;
@Config(desc = "value of current node")
@NotNull @Min(1)
private Integer value;
urxvt*perl-ext-common: default,matcher,clipboard
public class Item {
private String id;
private String name;
public Item(String id, String name) {
this.id = id;
this.id = name;
}
public String getId() { return id;}
public String getName() { return name; }
Predicate<Item> heavyItemPolicy = new Predicate<Item>() {
@Override
public boolean apply(Item item) {
if(item.getWeight() > 1000){
return true;
}
return false;
}
};
Collection<Item> heavyItems = Collections2.filter(order, heavyItemPolicy);
#! /usr/bin/perl
sub on_sel_grab {
my $query=quotemeta $_[0]-&gt;selection;
$query=~ s/\n/\\n/g;
$query=~ s/\r/\\r/g;
system( &quot;echo &quot; . $query . &quot; | xsel -i -b -p&quot; );
}