Skip to content

Instantly share code, notes, and snippets.

concocting something useful

Kunal Dabir kdabir

concocting something useful
Block or report user

Report or block kdabir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View travis_groovy.yml
#language: groovy
#sudo: true
- export GROOVY_VERSION=2.4.5
- wget$ -O /tmp/
- unzip /tmp/ -d $PWD/.groovy
- export PATH=$PATH:$PWD/.groovy/groovy-$GROOVY_VERSION/bin
- echo "groovy installed"
kdabir /
Last active Mar 7, 2018
TattleTale Gradle

TattleTale Gradle plugin

Add to build.gradle

apply from:''

And Run

$ gradle tattletaleReport

View consolidate_props.groovy
def out = new File("")
new File('webapp/WEB-INF/conf').eachFile { file ->
new File(file, "").text.eachLine { line ->
if (!line.trim().startsWith("#")){
out << "${}.${line}"
}else {
out << "${line}"
out << "\n"
View servlet_to_spring.groovy
class Servlet {
String name, fqcn
List patterns = []
def getPatternsStr() {
patterns.collect { /"$it"/ }.join(", ")
def web = new XmlSlurper().parse(new File('webapp/WEB-INF/web.xml'))
kdabir /
Created Oct 13, 2016
Boilerplate function for mapping a list to another using stream API internally. Note that this defeats the purpose of streams, which are lazy and combine operations together. Use it only for one level of mapping where logic is not piped and results need to be immediately realized.
static <T, R> List<R> map(List<T> list, Function<? super T, ? extends R> mapper) {
kdabir / valid_base64_chars.txt
Last active Aug 27, 2016
valid base64 chars
View valid_base64_chars.txt
kdabir / ratpack.groovy
Created Aug 19, 2016
Minimal ratpack, runnable and reloadable in GroovyConsole
View ratpack.groovy
import static ratpack.groovy.Groovy.ratpack
ratpack {
handlers {
get {
render "Hello World!"
kdabir / .gitignore
Created Aug 11, 2016
Ignores for java, IDEs and gradle
View .gitignore
###### OSX ######
###### Java ######
# Artifacts
# virtual machine crash logs
kdabir / ClassBasedComponent.js
Last active Aug 4, 2016
Creating React Components. Three flavours. Stateless component with only one expression, with multiline expression and with complete class
View ClassBasedComponent.js
import React from 'react';
export default class ClassBasedComponent extends React.Component {
constructor(props) {
// do something useful
componentWillMount() {
View json_from_string.groovy
import groovy.json.JsonSlurper
def json = new JsonSlurper().parseText("""
inline: "json"
You can’t perform that action at this time.