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
before_script:
- export GROOVY_VERSION=2.4.5
- wget http://dl.bintray.com/groovy/maven/apache-groovy-binary-$GROOVY_VERSION.zip -O /tmp/groovy.zip
- unzip /tmp/groovy.zip -d $PWD/.groovy
- export PATH=$PATH:$PWD/.groovy/groovy-$GROOVY_VERSION/bin
- echo "groovy installed"
@kdabir
kdabir / README.md
Last active Mar 7, 2018
TattleTale Gradle
View README.md

TattleTale Gradle plugin

Add to build.gradle

apply from:'https://gist.githubusercontent.com/kdabir/0dbf62e16e5af8ef55b43442148f0fe5/raw/depTree.gradle'

And Run

$ gradle tattletaleReport

View consolidate_props.groovy
def out = new File("application.properties")
new File('webapp/WEB-INF/conf').eachFile { file ->
new File(file, "app.properties").text.eachLine { line ->
if (!line.trim().startsWith("#")){
out << "${file.name}.${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
kdabir / GenericMap.java
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.
View GenericMap.java
static <T, R> List<R> map(List<T> list, Function<? super T, ? extends R> mapper) {
return list.stream().map(mapper).collect(Collectors.toList());
}
@kdabir
kdabir / valid_base64_chars.txt
Last active Aug 27, 2016
valid base64 chars
View valid_base64_chars.txt
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
@kdabir
kdabir / ratpack.groovy
Created Aug 19, 2016
Minimal ratpack, runnable and reloadable in GroovyConsole
View ratpack.groovy
@Grapes([
@Grab('io.ratpack:ratpack-groovy:1.4.0'),
@Grab('org.slf4j:slf4j-simple:1.7.21')
])
import static ratpack.groovy.Groovy.ratpack
ratpack {
handlers {
get {
render "Hello World!"
@kdabir
kdabir / .gitignore
Created Aug 11, 2016
Ignores for java, IDEs and gradle
View .gitignore
###### OSX ######
.DS_Store
###### Java ######
*.class
# Artifacts
*.jar
*.war
# virtual machine crash logs
hs_err_pid*
@kdabir
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) {
super(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.