Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
xuwei-k / gist:1139949
Created August 11, 2011 15:35
#Scala "methods" method
Welcome to Scala version 2.9.1.RC2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :power
** Power User mode enabled - BEEP BOOP SPIZ **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
** global._ and definitions._ also imported **
** Try :help, vals.<tab>, power.<tab> **
@xuwei-k
xuwei-k / RandomColourfulREPL.md
Created August 17, 2011 21:40
Scala REPL を無駄に Colourful にする方法

1. change power mode

scala> :power
** Power User mode enabled - BEEP BOOP SPIZ **
** :phase has been set to 'typer'.          **
** scala.tools.nsc._ has been imported      **
** global._ and definitions._ also imported **
** Try  :help,  vals.<tab>,  power.<tab>    **
val projectCommand = AttributeKey[Boolean]("project-command", "Marks Commands that were registered for the current Project.")
val sessionSettings = AttributeKey[SessionSettings]("session-settings", "Tracks current build, project, and setting modifications.")
val stateBuildStructure = AttributeKey[Load.BuildStructure]("build-structure", "Data structure containing all information about the build definition.")
val logged = AttributeKey[Logger]("log", "Provides a Logger for commands.")
val analysis = AttributeKey[inc.Analysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.")
val globalBaseDirectory = AttributeKey[File]("global-base-directory", "The base directory for global sbt configuration and staging.")
val isModule = AttributeKey[Boolean]("is-module", "True if the target is a module.")
val isDummyTask = AttributeKey[Boolean]("is-dummy-task", "Internal: used to identify dummy tasks. sbt injects values for these tasks at the start of task execution.")
val taskDefinitionKey
Welcome to Scala version 2.9.0.1 (OpenJDK 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import twitter4j.media.MediaProvider
import twitter4j.media.MediaProvider
scala> MediaProvider.
IMG_LY LOCKERZ MOBYPICTURE PLIXI POSTEROUS TWIPL TWIPPLE
TWITGOO TWITPIC YFROG asInstanceOf isInstanceOf toString
@xuwei-k
xuwei-k / sbt-project-list.md
Created August 26, 2011 15:47
sbt 0.10 系を使用している主なプロジェクトの、プロジェクト設定ファイル一覧
@xuwei-k
xuwei-k / gist:1178498
Created August 29, 2011 14:26
sbt には、session って概念があるらしく、sbt のコンソールで入力した任意のコマンドの中から指定したものだけを build.sbt に保存できる機能がありますよーーーーー
$ mkdir sbt-session-test
$ cd sbt-session-test
$ sbt
[info] Set current project to default-e081c7 (in build file:/Users/scalachan/sbt-session-test/)
> set scalaVersion := "2.9.0-1"
[info] Reapplying settings...
[info] Set current project to default-e081c7 (in build file:/Users/scalachan/sbt-session-test/)
> set libraryDependencies += "org.scala-tools.time" %% "time" % "0.4"
[info] Reapplying settings...
[info] Set current project to default-e081c7 (in build file:/Users/scalachan/sbt-session-test/)

generate sxr project

  1. save build.sbt

  2. compile

$ sbt compile
[info] Updating {file:/Users/user/generate-sxr-project/}default-e081c7...
[info] Done updating.
@xuwei-k
xuwei-k / gist-slide
Created September 3, 2011 22:35
gist slide
!SLIDE
# 超簡単にかっこいいSlideを作れるサイトをつくったよぉーー
!SLIDE
こんなことした↓
[Picture Show ためしてみたお( ^ω^) ](http://d.hatena.ne.jp/xuwei/20110903/1315044919)
@xuwei-k
xuwei-k / gist:1193200
Created September 4, 2011 17:40
twitter util の Eval を GAE 上で動かしたらエラー・・・(・ω・`)
Uncaught exception from servlet
java.lang.UnsupportedOperationException: Position.line
at scala.tools.nsc.util.Position$class.line(Position.scala:173)
at scala.tools.nsc.util.NoPosition$.line(Position.scala:193)
at com.twitter.util.Eval$StringCompiler$$anon$1.display(Eval.scala:404)
at scala.tools.nsc.reporters.AbstractReporter.info0(AbstractReporter.scala:45)
at scala.tools.nsc.reporters.Reporter.error(Reporter.scala:56)
at scala.tools.nsc.Global.error(Global.scala:141)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:72)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:35)