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
object GeoHash{ | |
val base32 = "0123456789bcdefghjkmnpqrstuvwxyz" | |
def encode( longtitude:Double, latitude:Double, range:Double) = { | |
def asBit( d:Double,max:Double,min:Double ) : List[Boolean] = { | |
val mid = ( max + min ) / 2 | |
var res = ( d >= mid ) | |
val (m,n) = if( res ) (max,mid) else (mid,min) | |
if( Math.abs( m - n ) <= range ) | |
res :: Nil |
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
jQuery(function ($) { | |
$.fn.ajaxDynamicSelect = function (target ,options) { | |
var opt = $.extend({ | |
url:'', // JSONを返すURLを設定 | |
paramName:'selectedValue', // JSONを取得する際にサーバに送るパラメータ名 | |
labelProperty:'text', // JSONの中でSelectのlabelに該当するプロパティ名 | |
valueProperty:'value' // JSONの中でSelectのvalueに該当するプロパティ名 | |
},options); | |
$(this).change( function(e){ |
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
object Base64 { | |
val BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" | |
def encode( s:String ) = encodeBuffer( s.getBytes ) | |
def encode( s:String, charset:String ) = encodeBuffer( s.getBytes( charset ) ) | |
private def encodeBuffer( buf:Array[Byte] ) = { | |
val bits = fill( buf.map{ | |
b => if( b < 0 ) b + 256 else b.toInt | |
}.map{ |
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
Index: src/moeclipse/JavaBackgroundModifier.java | |
=================================================================== | |
--- src/moeclipse/JavaBackgroundModifier.java (リビジョン 1412) | |
+++ src/moeclipse/JavaBackgroundModifier.java (作業コピー) | |
@@ -1,55 +1,137 @@ | |
package moeclipse; | |
-import java.net.MalformedURLException; | |
+import java.awt.image.BufferedImage; | |
+import java.io.IOException; |
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
// http://ja.wikipedia.org/wiki/恵方#.E6.81.B5.E6.96.B9 | |
object 恵方{ | |
import java.util.{Date,Calendar} | |
def 今年の恵方 = この年の恵方は_?( Calendar.getInstance ) | |
def この年の恵方は_? ( 年:Calendar ):恵方 = 年.get( Calendar.YEAR ) % 5 match { | |
case 0 => 恵方("庚の方","申と酉の中間","255°","西微南やや左","西南西やや右") | |
case 1 => 恵方("丙の方","巳と午の中間","165°","南微東やや左","南南東やや右") |
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
def www( s:String ):String = { | |
import scala.util.Random | |
val rnd = new Random( ) | |
val ws = List( "w","W","w" ) | |
def w(n:Int):String = ( 0 - n) until rnd.nextInt(3) map { i => ws( rnd.nextInt( ws.size -1 ) ) } mkString | |
("ちょ" + w(1) + "おま" + w(1) ) + ("" /: s ){ ( c,e ) => c + e + w(0) } + w(0) | |
} |
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 scala.util.parsing.combinator._ | |
sealed abstract class Op { def exec(bf:BF) } | |
case class Inc(token:String) extends Op { | |
def exec( bf:BF ) = bf.inc | |
} | |
case class Dec(token:String) extends Op{ | |
def exec( bf:BF ) = bf.dec | |
} |
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 scala.util.parsing.combinator._ | |
// http://homepage2.nifty.com/kujira_niku/okayu/misa.html | |
sealed abstract class Op { | |
def exec(misa:Misa) | |
val token:String | |
override def toString = token | |
} | |
case class Inc(token:String) extends Op { |
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
/** | |
* Brainf*ck派生言語のジェネレータ | |
*/ | |
import scala.util.parsing.combinator._ | |
import scala.util.parsing.input.{Position, NoPosition} | |
sealed abstract class Op { | |
def exec( runtime:BFRuntime ) | |
val token:String |
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 scala.util.parsing.combinator._ | |
sealed abstract class Op { | |
def exec(jojo:JoJo) | |
val token:String | |
override def toString = token | |
} | |
case class Inc(token:String) extends Op { | |
def exec( jojo:JoJo ) = jojo.inc |