Skip to content

Instantly share code, notes, and snippets.

View kdabir's full-sized avatar
👨‍💻
go git it

Kunal Dabir kdabir

👨‍💻
go git it
View GitHub Profile
@kdabir
kdabir / append.groovy
Created January 30, 2014 21:43
using ant to append text to file
def ant = new AntBuilder()
ant.concat(destfile: "myfile", append: true, "hello")
@kdabir
kdabir / constructor.groovy
Last active August 29, 2015 13:55
default constructor is still called when properties hashmap is snet.
class MyClass {
def x
MyClass() {
println "hello"
}
}
println new MyClass(x:10).x
@kdabir
kdabir / Main.groovy
Created February 1, 2014 10:35
Differences between java and groovy method dispatch. Compare the output of both programs
public class Main {
void prettyPrint(Person p) {
System.out.println("Main Person: " + p);
}
void prettyPrint(Employee e) {
System.out.println("Main Employee: " + e);
}
@kdabir
kdabir / swap.md
Created February 9, 2014 13:05
swapping two ints mathematically
int a =-5, b=10;

a=a+b;
b=a-b;
a=a-b;
@kdabir
kdabir / call.groovy
Last active August 29, 2015 13:56
Groovy object as method
class A {
def call (){println "hello"}
}
def a = new A()
a()
@kdabir
kdabir / README.md
Last active August 29, 2015 13:56
This script pulls your starred repos on github and shows some interesting stats at the end. It was created as an example demonstrating how Gstorm is useful in scripts.

This script is created as an example to show how easy it is to use gstorm to crunch and consume data from rest apis.

Usage

Either download the script and run:

groovy ghstarred.groovy <your_github_id>

Or hotload it:

@kdabir
kdabir / README.md
Created March 4, 2014 07:27
Using Scala xml, the things am learning

checking if a node is pure value of consists of neseted element

scala> (<a x="x">value</a>).child.forall(_.isAtom)
res67: Boolean = true

scala> (<a x="x"><b>value</b></a>).child.forall(_.isAtom)
res68: Boolean = false
for f in $(find . -type d -maxdepth 3 -name bin); do; echo $f;done
@kdabir
kdabir / uniq_methods.groovy
Created March 18, 2014 03:32
uniq methods
String.metaClass.methods*.name.sort().unique()
@kdabir
kdabir / install_wildfly.sh
Created April 8, 2014 18:08
One liner installation for Wildfly. Execute it, let it complete and open a new terminal and run wildfly with standalone.sh. It takes care of path by itself.
curl -L http://git.io/nixstall | bash -s get http://download.jboss.org/wildfly/8.0.0.Final/wildfly-8.0.0.Final.zip