Skip to content

Instantly share code, notes, and snippets.

fun isPrimeRec(number: Int, divisor: Int, maxDivisor: Int) =
when {
number % divisor == 0 -> true
else -> divisor < maxDivisor && isPrime(number, divisor + 2, maxDivisor)
}
}
fun isPrime(number: Int) {
when {
number <= 1 -> false
class User {
@NotNull
String firstName;
}
void validate(User user) {
return javax.validation.Validation
.buildDefaultValidatorFactory()
.getValidator()
.validate(user);
0xD66bC9E9ecaa402689827E193878a042d042eDab

Keybase proof

I hereby claim:

  • I am djalexd on github.
  • I am djalexd (https://keybase.io/djalexd) on keybase.
  • I have a public key ASBsbk9ks-DXpNY-IbKrp4fW-x0caLfN67BgUxBHNjWwbwo

To claim this, I am signing this object:

;; database name = connect string
;;
;; connect string params:
;; dbname= host= port= user= password=
;; client_encoding= datestyle= timezone=
;; pool_size= connect_query=
[databases]
{{ $default_pool_mode := "session" }}
{{ $default_pool_size := "90" }}
class T<V> {
private String key;
private Set<V> items;
}
You have a Collection<T> and are required to return a Collection<T> where T objects
that have same 'key' will contains grouped 'items'.
Example:
@djalexd
djalexd / logstash.conf
Last active August 29, 2015 14:11
logstash config #1
input {
file {
type => "service"
path => [ "/data/logs/accounts*.log" ]
tags => [ "service-accounts" ]
}
file {
type => "service"
path => [ "/data/logs/payment-instruments*.log" ]
function AttachmentCtrl($scope, $location, $timeout, Docs) {
$(function() {
$('#detail-form-doc').fileupload({
dataType: 'json',
url: '/angular-ib/app/fileupload?id=' + $location.search().id,
add: function(e, data) {
$scope.$apply(function(scope) {
// Turn the FileList object into an Array
for (var i = 0; i < data.files.length; i++) {
$scope.project.files.push(data.files[i]);