in ascending order of how easy they are to guess
additions/corrections welcome
- paulproteus = Asheesh Laroia = @asheeshlaroia
| import scalaz._ | |
| import Scalaz._ | |
| import effects._ | |
| object Main extends App { | |
| /* Haskell-style pure main */ | |
| def pmain: IO[Unit] = { | |
| val infiniteStream: Stream[String] = Stream continually "hello, world" | |
| infiniteStream.foldr(().pure[IO]) { (el, acc) => |
| trait WithContext { | |
| var ctx = null | |
| def setContext(c:Context): Unit = if (ctx == null) { | |
| ctx = c | |
| } else { | |
| sys.error("already set") | |
| } | |
| def fromContext[T](k:String):T = if (ctx == null) { | |
| sys.error("premature access") | |
| } else { |
| /* RetroLogger.scala | |
| * | |
| * A handy sbt-0.10.x plugin that allows you to set the log level like in the | |
| * old days (AKA sbt-0.7.x). | |
| * | |
| * It works by creating aliases of this form: | |
| * "set logLevel := Level.Debug" ====> "debug" | |
| * | |
| * Installation: | |
| * - mkdir -p ~/.sbt/plugins/ |
in ascending order of how easy they are to guess
additions/corrections welcome
| #!/usr/bin/python | |
| # GNOME customization script. | |
| # | |
| # Tested on Ubuntu 10.10, Debian Squeeze, Debian Sid (circa April 2011). | |
| # Run as root. | |
| # | |
| # @author Yuvi Masory | |
| import getpass |
| /** Use with a default value, for example: | |
| * runningScalaVersion getOrElse "2.8.0" | |
| */ | |
| lazy val runningScalaVersion = { | |
| val matcher = """version (\d+\.\d+\.\d+).*""".r | |
| util.Properties.versionString match { | |
| case matcher(versionString) => Some(versionString) | |
| case _ => None | |
| } | |
| } |
| #!/usr/bin/python | |
| # | |
| # Automatically synchronize your workspace with GitHub using the GitHub API. | |
| # | |
| # Prerequisites: | |
| # - Install pip. | |
| # On Ubuntu: sudo apt-get install python-pip | |
| # - Using pip, install github2 Python bindings. | |
| # sudo pip install github2 | |
| # - Install curl. |
| import sbt._ | |
| class Project(info: ProjectInfo) extends DefaultProject(info) with ProguardProject { | |
| //project name | |
| override val artifactID = "myprogram" | |
| //program entry point | |
| override def mainClass: Option[String] = Some("com.example.MyMainClass") | |
| //proguard |
| import sbt._ | |
| class Plugins(info: ProjectInfo) extends PluginDefinition(info) { | |
| val proguard = "org.scala-tools.sbt" % "sbt-proguard-plugin" % "0.0.4" | |
| } |