Skip to content

Instantly share code, notes, and snippets.

View ymnk's full-sized avatar

Atsuhiko Yamanaka ymnk

View GitHub Profile
import javax.swing.{ImageIcon, JWindow, JLabel}
import java.net.URL
import scala.xml.XML
import scala.collection.mutable.Queue
import scala.actors.Actor
import scala.actors.Actor.loop
import scala.concurrent.ops.spawn
object ViewImagesInFeed extends Application {
import java.net.{Authenticator, PasswordAuthentication}
import java.net.{URL, HttpURLConnection}
import scala.xml.XML
import java.text.SimpleDateFormat
import java.util.Locale
object TwitterTimeline {
def main(arg:Array[String]){
import scala.tools.nsc.{Interpreter, Properties, Settings}
import scala.util.matching.Regex
import java.io.ByteArrayOutputStream
import Thread.currentThread;
/**
* This program demonstrates the dynamic compilation and loading to JVM.
*
* A string will be read from stdin, and compiled and loaded dynamically.
* If the result is the function of String => _, "Hello" will be applied to it.
import scala.tools.nsc.{Interpreter, Properties, Settings}
import scala.tools.nsc.{InterpreterResults=>IR}
import java.io.ByteArrayOutputStream
import java.lang.reflect.Method
import Thread.currentThread;
import scala.util.matching.Regex
/**
* This program demonstrates the dynamic compilation and loading to JVM.
*
import jp.takeda_soft.examples.{Plotter, SButton}
import java.lang.Math._
import javax.swing.JFrame
import java.awt.BorderLayout
import scala.concurrent.ops.spawn
import scala.tools.nsc.Properties
/**
* This program will read anonymous functions in Int=>Int from stdin.
* After compiling and loading them dynamically, the 2D graph will be
import swing._
import swing.event._
import scala.concurrent.ops.spawn
object TakahashiMethodInScalaSwing extends SimpleGUIApplication {
def top = new MainFrame {
title = "TakahashiMethodInScalaSwing"
/**
* MainFrame has already defined
package jp.takeda_soft.examples
/**
世界のナベアツに挑戦
テーマ:implicitによるScalaAPIの拡張
*/
object Nabeatsu extends Application {
//Intがバカになるメソッド"!"を追加
implicit def bakanize(n: Int) = new Bakanizer(n)
import scala.xml._
import scala.collection.mutable.{Map, HashMap}
/**
* The XML2JSON object will transform the XML data in scala.xml.Node to
* the string in JSON format.
*/
object XML2JSON {
sealed trait JSONObject
import scala.util.parsing.combinator.lexical.StdLexical
import scala.util.parsing.combinator.syntactical.StdTokenParsers
/**
* This program will parse the arithmetic expression defined as follows,
* <exp> ::= <term> | <exp> "+" <term> | <exp> "-" <term>
* <term> ::= <factor> | <term> "*" <factor> | <term> "/" <factor>
* <factor> ::= <n> | "(" <exp> ")"
* , where n is a nonterminal symbol for numbers.
*
import scala.xml._
import scala.util.parsing.json.JSON
/**
* The XML2JSON object will transform a string in json format to
* a NodeSeq object.
*/
object JSON2XML {
def apply(input:String):NodeSeq = {