Skip to content

Instantly share code, notes, and snippets.

View yuroyoro's full-sized avatar
🍣
🍣

しいたけ yuroyoro

🍣
🍣
View GitHub Profile
import java.net.URL
import java.awt.image.BufferedImage
import javax.imageio.ImageIO
import java.io._
import scala.xml._
import scala.io.Source
object TumblrCrawler {
def main( args:Array[String] ):Unit= {
object ScreennameToId {
import scala.xml._
import scala.io.Source
def main(args:Array[String]) = {
val source = Source.fromURL("http://twitter.com/users/show.xml?screen_name=%s".format(args.first))
val xml = XML.loadString( source.getLines.mkString )
println( xml \\ "id" text)
}
}
import java.net.{Authenticator, PasswordAuthentication}
import scala.Math._
import scala.xml._
import scala.io.Source
object TwitterListRecommender{
val url ="http://twitter.com/%s/lists/memberships.xml"
// Usage : scala TwitterListRecommender <your_id> <your_password>
import scala.xml._
import scala.io.Source
object HashTagSearch{
def main( args:Array[String] ){
val url =
"http://search.twitter.com/search.atom?q=%s".format( args.first )
( XML.loadString(
Source.fromURL( url, "utf-8").getLines.mkString) \\ "entry").
foreach{
import scala.xml._
import scala.io.Source
object Chu2Name{
def main( args:Array[String] ){
val url = "http://pha22.net/name2/c/%s".format( args.first )
val r ="""「(.+)((.+))」""".r
Source.fromURL( url, "utf-8").getLines.foreach{
s => r.findFirstMatchIn(s).
trait MaxLenValidation {
val maxLen:Int
msg :String
override def validations =
valMaxLen( maxLen,msg )_ :: super.validations
}
class Memo extends LongKeyedMapper[Message] with IdPK {
def getSingleton = Message
//ガウス=ルジャンドルのアルゴリズム
// あとでBigDecimalになおす
def calcPI( ac:Int ):Double = {
def stop_?( d:Double ) = d.toString.length > ac + 2
def calc( a:Double , b:Double, t:Double, p:Double ):Double = {
println("%f, %f, %f, %f".format( a, b, t, p ) )
if( stop_?( a ) && stop_?( b ) ) Math.pow( a + b , 2) / (4 * t)
else{
val x = ( a + b ) / 2
val y = Math.sqrt( a * b )
import scala.xml._
import scala.io.Source
object HashTagSearch{
def main( args:Array[String] ){
val url =
"http://search.twitter.com/search.atom?q=%s".format( args.first )
( XML.loadString(
Source.fromURL( url, "utf-8").getLines.mkString) \\ "entry").
     ( ゚ω゚ )
ヒショヒショC□l丶l丶 秘書なら任せろ
     /  (   ) 
     (ノ ̄と、 i やめて
        しーJ
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
public class JpTest {
@Test
public void asciiMethodNameTest(){
assertThat(true, is( true));