This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package play.modules.migrate; | |
import org.hibernate.dialect.MySQL5Dialect; | |
import org.hibernate.ejb.Ejb3Configuration; | |
import org.hibernate.tool.hbm2ddl.DatabaseMetadata; | |
import play.Play; | |
import play.db.DB; | |
import play.db.DBPlugin; | |
import play.utils.Utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- new table for simple entity | |
create table SimpleEntity ( | |
id bigint not null auto_increment, | |
age integer not null, | |
isEternal bit not null, | |
name varchar(255), | |
primary key (id) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans> | |
<bean id="applicationConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> | |
<property name="locations"> | |
<list> | |
<value>classpath:app-dev.properties</value> | |
<value>${app.properties}</value> | |
</list> | |
</property> | |
<property name="ignoreUnresolvablePlaceholders" value="true"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Test; | |
import java.util.Date; | |
import static org.junit.Assert.assertEquals; | |
public class StringFormatTest { | |
@Test public void basicInteger() { | |
assertEquals("123456", String.format("%d", 123456)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctx; | |
var canvasObj; | |
var fps = 30; | |
var stars = []; | |
var starCount = 30; | |
var Animation = { | |
init : function(id) { | |
canvasObj = document.getElementById(id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>ForkMeSun</title> | |
<link href='http://fonts.googleapis.com/css?family=Dorsa' rel='stylesheet' type='text/css'> | |
</head> | |
<body> | |
<a href="http://huljas.github.com"> | |
<canvas id="forkMe" width="150" height="150"> | |
</canvas> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the slice width that correlates with high distances | |
def find_slice_width(): | |
dm = sorted( [(x, slice_distance(x,x+1)) for x in range(0,width-1)], key=lambda d: d[1], reverse=True) | |
for w in range(2,width/2): | |
m = width / w - 1 | |
p = len( filter(lambda dd: (dd[0]+1) % w == 0, dm[:m]) ) | |
if p / float(m) > 0.6: | |
return w | |
return 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* My languages song. | |
* | |
* Inspired by the Finland song from Monty Python. | |
*/ | |
public class Song { | |
public static void main(String[] args) { | |
String s = "Java, Java, Java\n" | |
+ "The language I want to be\n" | |
+ "Debugging or Test Driving\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.jamonapi.Monitor; | |
import com.jamonapi.MonitorFactory; | |
import org.apache.commons.lang.StringUtils; | |
import org.aspectj.lang.ProceedingJoinPoint; | |
import org.aspectj.lang.annotation.Around; | |
import org.aspectj.lang.annotation.Aspect; | |
import org.aspectj.lang.reflect.MethodSignature; | |
import org.springframework.stereotype.Component; | |
import java.util.regex.Pattern; |
OlderNewer