Skip to content

Instantly share code, notes, and snippets.

@katta
katta / mvncolor.sh
Created June 15, 2011 18:50
Script to add colors to maven output
#!/usr/bin/env bash
# Formatting constants
export BOLD=`tput bold`
export UNDERLINE_ON=`tput smul`
export UNDERLINE_OFF=`tput rmul`
export TEXT_BLACK=`tput setaf 0`
export TEXT_RED=`tput setaf 1`
export TEXT_GREEN=`tput setaf 2`
export TEXT_YELLOW=`tput setaf 3`
@katta
katta / gitdiff-svnpatch.sh
Created June 16, 2011 08:10
Converts git diff to svn patch format
git diff --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" --ignore-space-at-eol > changes.patch
@katta
katta / CouchDB_Example_BlogPost.java
Created July 6, 2011 12:33
CouchDB_Example_BlogPost
@TypeDiscriminator("doc.documentType == 'BlogPost'")
public class BlogPost extends CouchEntity {
private String name;
@DocumentReferences(backReference="blogPostId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Set<Comment> comments = new HashSet<Comment>();
/* getters and setters */
}
@katta
katta / CouchDB_Example_Comment.java
Created July 6, 2011 12:49
CouchDB_Example_Comment
@TypeDiscriminator("doc.documentType == 'Comment'")
public class Comment extends CouchEntity {
private String blogPostId;
private String notes;
/* getters and setters */
}
@katta
katta / CouchDB_Example_BlogPostWithComment.java
Created July 6, 2011 12:51
CouchDB_Example_BlogPostWithComment
@TypeDiscriminator("doc.documentType == 'BlogPost'")
public class BlogPost extends CouchEntity {
private String name;
@DocumentReferences(backReference="blogPostId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Set<Comment> comments = new HashSet<Comment>();
/* getters and setters */
public void addComment(Comment comment) {
comment.setBlogPostId(this.getId());
@katta
katta / CouchDB_Example_BlogPostIntegrationTest.java
Created July 6, 2011 12:52
CouchDB_Example_BlogPostIntegrationTest
public class BlogPostIntegrationTest extends SpringIntegrationTest {
@Autowired
private BlogPosts blogPosts;
@Test
public void shouldPersistWithChildren() {
BlogPost blogPost = new BlogPost();
blogPost.setName("the blog");
blogPosts.add(blogPost);
@katta
katta / Jenkins_Growl_Notifier.rb
Created July 10, 2012 15:05
Growl notifier for jenkins
#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'net/http'
require 'uri'
require 'date'
$ciBaseUrl = 'http://ci.motechproject.org' #URL of your jenkins CI
$jobs = ['Ananya-Kilkari','Ananya-Reports','Ananya-Kilkari-Smoke'] # add all the jobs to be monitored in this list
@katta
katta / gist:3437976
Created August 23, 2012 15:58
Fakerest sample configuration file
---
method : get
path : /customer/:id
response:
content_file : customer
content_type : json
status_code : 200
---
method : post
path : /customer
@katta
katta / fakerest-readme.md
Created September 4, 2012 17:16
What is fakerest

Fakerest

Fakerest is a simple tool based on sinatra which starts a http server (webrick) and exposes restful services based on the configuration specified in a YAML format.

Features

You can :

  • Stub any of the restful servies be it any method GET, POST, HEAD, PUT etc.
  • Configure multiple URLs based on your need
@katta
katta / es-plugin.properties
Created December 21, 2012 11:11
Elastic Search plugin properties
plugin=org.katta.es.plugin.http.CustomRestHandlerPlugin