Skip to content

Instantly share code, notes, and snippets.

View behrangsa's full-sized avatar
💾

Behrang Saeedzadeh behrangsa

💾
View GitHub Profile
class MyControoler
end
public class Logger {
private Level level = Level.WARNING;
public void setLevel(Level level) {
this.level = level;
}
public void log(Level level, { => String} message) {
if (this.level == level) {
@behrangsa
behrangsa / Level.java
Created June 4, 2011 03:01
Log Level
public enum Level {
INFO,
WARNING
}
@behrangsa
behrangsa / Main.java
Created June 4, 2011 03:02
Usage example
import java.util.Calendar;
public class Main {
private static final Logger LOG = new Logger();
public static void main(String[] args) {
LOG.setLevel(Level.WARNING);
package org.behrang.deliciouscleaner
@Grab(group = "net.sf.delicious-java", module = "delicious", version = "1.14")
import del.icio.us.Delicious
def d = new Delicious("username", "password")
def posts = d.allPosts
posts.eachWithIndex { p, i ->
println (i+1) + "/" + posts.size()
@behrangsa
behrangsa / buggy.xsl
Created June 4, 2011 03:07
Unused variable
<xsl:variable name="unusedVariable" select="util:aUtilityMethod()" />
@behrangsa
behrangsa / force.xsl
Created June 4, 2011 03:08
Force invokation of function
<xsl:comment>
<xsl:value-of select="$unusedVariable" />
</xsl:comment>
@behrangsa
behrangsa / gist:1007528
Created June 4, 2011 03:12
Dependencies
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.2.GA</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
@behrangsa
behrangsa / gist:1007529
Created June 4, 2011 03:13
Repositories
<repositories>
<repository>
<id>jboss</id>
<url>http://repository.jboss.com/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
@behrangsa
behrangsa / gist:1007530
Created June 4, 2011 03:14
Short-form Dependency
log4j:log4j:1.2.14