This re-styles your sublime text sidebar to be dark, it fits default Monokai theme.
Save the Default.sublime-theme file into packages/Theme - Default, make a backup of your original if you want to be able to go back easily.
Based on:
#!/usr/bin/env ruby | |
body = STDIN.read | |
body.gsub!(/\{\{\{([^\n]+?)\}\}\}/, '`\1`') | |
body.gsub!(/\{\{\{(.+?)\}\}\}/m){|m| m.each_line.map{|x| "\t#{x}".gsub(/[\{\}]{3}/,'')}.join} | |
body.gsub!(/\=\=\=\=\s(.+?)\s\=\=\=\=/, '### \1') | |
body.gsub!(/\=\=\=\s(.+?)\s\=\=\=/, '## \1') | |
body.gsub!(/\=\=\s(.+?)\s\=\=/, '# \1') | |
body.gsub!(/\=\s(.+?)\s\=[\s\n]*/, '') |
import scala.slick.lifted.CanBeQueryCondition | |
// optionally filter on a column with a supplied predicate | |
case class MaybeFilter[X, Y](val query: scala.slick.lifted.Query[X, Y]) { | |
def filter[T,R:CanBeQueryCondition](data: Option[T])(f: T => X => R) = { | |
data.map(v => MaybeFilter(query.filter(f(v)))).getOrElse(this) | |
} | |
} | |
// example use case | |
import java.sql.Date |
package slick | |
/** | |
* This is some code extracted from TimeOut codebase, demonstrating: | |
* - Use of tag typed to avoid mixing session of different DB | |
* - The use of the Reader Monad to compose Actions together and defer the choice of async/sync computation | |
* | |
* I remove the part where we can say if our operation are read only or not (to use different connection), in order to | |
* make things easier. | |
**/ |
brew update | |
brew versions FORMULA | |
cd `brew --prefix` | |
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions" | |
brew install FORMULA | |
brew switch FORMULA VERSION | |
git checkout -- Library/Formula/FORMULA.rb # reset formula | |
## Example: Using Subversion 1.6.17 | |
# |
package com.sport195.api | |
import play.api.libs.json._ | |
import scala.language.experimental.macros | |
object ImplicitConversions { | |
import java.sql.Timestamp | |
import java.sql.Date | |
implicit val x = scala.language.implicitConversions |
import Predef.{any2stringadd => _,_} | |
// GUESS THE INFERRED TYPE FOR ys! | |
class :=[T,Q] | |
object := { | |
/** Ignore default */ | |
implicit def useProvided[P, D] : P := D = new (P := D) | |
/** Infer type argument to default */ | |
implicit def useDefault[D] : D := D = new (D := D) | |
} |
import org.specs2._ | |
import execute._ | |
import specification._ | |
import core._ | |
class TestSuite(tests: Fragment*) extends Specification { | |
def is = br ^ Fragments.foreach(tests)(f => Fragments(f, br)) | |
} | |
object TestSuite { |
This re-styles your sublime text sidebar to be dark, it fits default Monokai theme.
Save the Default.sublime-theme file into packages/Theme - Default, make a backup of your original if you want to be able to go back easily.
Based on:
% sbtx dependencyGraph | |
... blah blah ... | |
[info] *** Welcome to the sbt build definition for Scala! *** | |
[info] Check README.md for more information. | |
[error] Not a valid command: dependencyGraph | |
[error] Not a valid project ID: dependencyGraph | |
% sbtx -Dplugins=graph dependencyGraph | |
... blah blah ... |
This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere… I hope to present the information you need without assuming anything.
Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!
One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.