Skip to content

Instantly share code, notes, and snippets.

View keerts's full-sized avatar

Gert-Jan van de Streek keerts

View GitHub Profile
@keerts
keerts / ElasticSearchEvaluation.java
Created February 1, 2012 15:18
Unit test for evaluating elasticsearch
package nl.avisi.langur.search;
import static org.elasticsearch.common.xcontent.XContentFactory.*;
import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.elasticsearch.node.NodeBuilder.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.io.IOException;
@keerts
keerts / detectGlobals
Created February 16, 2012 22:17
detectGlobals Javascript helper
var detectGlobals = (function () {
function getPropertyDescriptors(object) {
var props = {};
for (var prop in object) {
props[prop] = {
type: typeof object[prop],
value: object[prop]
}
}
return props;
@keerts
keerts / InputProvidingRunner
Created March 12, 2012 09:08
Flexible methods in JUnit
package nl.avisi.langur.test;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.List;
import org.apache.commons.io.IOUtils;
@keerts
keerts / setup_multi_field.sh
Created June 1, 2012 21:03
searching with ._all in multi_field
curl -XDELETE 'http://localhost:9200/translations/'
curl -XPUT 'http://localhost:9200/translations/' -d '
{
"index" : {
"name" : "translations",
"number_of_shards" : 1,
"analysis" : {
"analyzer" : {
@keerts
keerts / gist:8848172
Last active August 29, 2015 13:56
cucumber.js, a more functional example (world.js)
var req = require('superagent');
var Q = require('q');
var app, db, config
var World = function World(callback) {
// app = ... insert code here to start up your express / whatever server and cleanse your database
var self = this
@keerts
keerts / gist:8848223
Created February 6, 2014 16:58
cucumber.js, a more functional example (stepdefinition.js)
var Q = require('q');
var _ = require('lodash');
var myStepDefinitionsWrapper = function() {
this.World = require("../support/world.js").World; // overwrite default World constructor
this.Given(/^there are (\d+) events$/, function(count, callback) {
var self = this;
var arr = _.times(count, function(i) {
package nl.avisi.jira;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import com.atlassian.jira.component.ComponentAccessor;
import clojure.java.api.Clojure;
○ → LEIN_REPL_PORT=33475 lein repl :connect
Connecting to nREPL at 127.0.0.1:33475
REPL-y 0.3.5, nREPL 0.2.10
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.7.0_60-b19
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
user=> (import 'com.atlassian.jira.component.ComponentAccessor)
com.atlassian.jira.component.ComponentAccessor
user=> (def issue-manager (com.atlassian.jira.component.ComponentAccessor/getIssueManager))
#'user/issue-manager
user=> (.getIssue issue-manager "TEST-2")
{"summary" "Test2", "votes" 0, "fixfor" nil, "resolution" nil, "security" nil, "resolutiondate" nil, "type" "3", "timespent" nil, "creator" "admin", "id" 10001, "reporter" "admin", "updated" #inst "2015-04-30T17:09:01.105000000-00:00", "created" #inst "2015-04-30T17:09:01.105000000-00:00", "component" nil, "description" nil, "priority" "3", "duedate" nil, "watches" 1, "key" nil, "status" "10001", "assignee" "admin", "number" 2, "project" 10000, "environment" nil, "workflowId" 10001, "timeestimate" nil, "timeoriginalestimate" nil}
user=>

Keybase proof

I hereby claim:

  • I am keerts on github.
  • I am keerts (https://keybase.io/keerts) on keybase.
  • I have a public key ASDdOsFrqjbhWFdfGC9n0Yml7uNjTV-TUsKx5OrX_OwwRwo

To claim this, I am signing this object: