This file contains hidden or 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 java.text.SimpleDateFormat; | |
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.Locale; | |
import net.arnx.jsonic.JSON; | |
import net.arnx.jsonic.JSONHint; | |
import org.codehaus.jackson.map.ObjectMapper; |
This file contains hidden or 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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>sandbox</groupId> | |
<artifactId>sandbox</artifactId> | |
<version>1.0.0-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>sandbox</name> | |
<repositories> |
This file contains hidden or 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 android.content.ContentValues; | |
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; | |
public abstract class AbstractSQLiteSupport { | |
protected SQLiteDatabase db; | |
public AbstractSQLiteSupport(SQLiteDatabase db) { | |
this.db = db; |
This file contains hidden or 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
--- hatena_star.rb.orig 2009-08-04 23:33:41.000000000 +0900 | |
+++ hatena_star.rb 2010-08-29 03:55:37.000000000 +0900 | |
@@ -20,7 +20,14 @@ | |
container: 'h3' | |
} | |
} | |
- };\n| | |
+ }; | |
+ (function() { | |
+ var NodeInsert = function(evt) { |
This file contains hidden or 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 java.io._ | |
import java.util._ | |
import java.util.ResourceBundle.Control | |
import java.net._ | |
import java.security._ | |
class CharsetSupportedControl(charset: String = "utf-8") extends Control { | |
override def newBundle(baseName: String, locale: Locale, format: String, loader: ClassLoader, reload: Boolean) : ResourceBundle= { | |
if ("java.class" == format) { | |
super.newBundle(baseName, locale, format, loader, reload) |
This file contains hidden or 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 java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.net.URLConnection; | |
import java.security.AccessController; | |
import java.security.PrivilegedActionException; | |
import java.security.PrivilegedExceptionAction; | |
import java.text.MessageFormat; |
This file contains hidden or 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 scala.collection.JavaConversions._ | |
import java.lang.reflect.{Type, ParameterizedType} | |
import jp.sf.amateras.mirage._ | |
import jp.sf.amateras.mirage.session._ | |
abstract class AbstractService[T] { | |
private def findEntityClass() : Option[Class[_]] = { | |
def genericParameter(t: Type) : scala.Array[Type] = { | |
if (classOf[ParameterizedType].isInstance(t)) { |
This file contains hidden or 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
def calc(n: Int)(block: Int => Int) = { | |
block(n) | |
} | |
println(calc(10) { n => | |
if (n % 2 == 0) return 0 | |
n * 2 | |
}) |
This file contains hidden or 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 scala.util.matching.Regex | |
object NamedCapturing { | |
val namedCapture = """\((\?<(.+?)>)(.+?)\)""".r | |
def regex(path: String) : Regex = { | |
val (r, names) = parse((path, Array[String]())) | |
new Regex(r, names: _*) | |
} |
This file contains hidden or 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
object Benchmark { | |
import java.lang.management.ManagementFactory | |
val CAPTION = " user system total real" | |
def benchmark(block: Job => Unit) : Unit = benchmark(1)(block) | |
def benchmark(count: Int)(block: Job => Unit) : Unit = { | |
val job = new Job(count) | |
block(job) | |
job.dump() |