Skip to content

Instantly share code, notes, and snippets.

View antonarhipov's full-sized avatar
💣

Anton Arhipov antonarhipov

💣
View GitHub Profile
import java.util.BitSet;
import java.util.concurrent.CountDownLatch;
public class WordTearingExample {
public static void main(String[] args) throws Exception {
BitSet bs = new BitSet();
CountDownLatch latch = new CountDownLatch(1);
System.out.println("getting ready");
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
Morphia morphia = new Morphia();
Datastore ds = morphia.map(Repository.class).
createDatastore(new MongoClient("localhost", 27017), "mydb");
Organization org = new Organization("MegaOrg");
Repository repository = new Repository(org, "MegaRepository");
repository.owner = new GithubUser("Antonius");
repository.owner.fullName = "Anton";
repository.owner.repositories = Arrays.asList(repository);
ds.save(repository);
import com.mongodb.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.Endpoint;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringJoiner;
@antonarhipov
antonarhipov / gist:db4f4002c6a1813d349b
Last active October 8, 2015 02:07
Gradle build for Java web application with Kotlin
buildscript {
ext.kotlin_version = '0.9.976'
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@antonarhipov
antonarhipov / gist:4fbf350a6a0cdb06ff86
Last active August 29, 2015 14:10
Kotlin servlet with CDI bean
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import javax.servlet.annotation.WebServlet as web
import javax.inject.Inject
import javax.enterprise.context.Dependent
web(name = "Hello", value = array("/hello"))
public class HomeController : HttpServlet() {
<?xml version="1.0" encoding="UTF-8"?>
<project name="muCommander" default="default" basedir=".">
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="appbundler-1.0.jar" />
<target name="bundle">
<bundleapp outputdirectory="."
name="muCommander"
@antonarhipov
antonarhipov / gist:15be2f6a868dd0f82b72
Last active July 3, 2017 17:46
Setting up XRebel for Grails 3
//in build.gradle:
project.afterEvaluate {
for (Task task : project.getTasks()) {
if (task instanceof JavaExec) {
(task as JavaExec).jvmArgs "-javaagent:xrebel.jar"
}
}
}
@antonarhipov
antonarhipov / gist:c3331f28bc7fe087e2c3
Created April 4, 2015 17:06
Setting up XRebel for Grails 3, DSL version
//in build.gradle:
tasks.withType(JavaExec) { jvmArgs "-javaagent:xrebel.jar" }
" set cursorline
set expandtab
set modelines=0
set shiftwidth=2
set clipboard=unnamed
set synmaxcol=128
set ttyscroll=10
set encoding=utf-8
set tabstop=2
set nowrap