Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
// Version: v1.0.0-pre.2-370-g6a165ad
// Last commit: 6a165ad (2013-01-10 15:58:36 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug
App.Router.map (match) ->
(match "/user").to "user", (match) ->
(match "/").to "userIdx"
(match "/settings").to "userSetup", (match) ->
(match "/").to "userSetupIdx"
(match "/profile").to "userSetupProf"
(match "/password").to "userSetupPass"
#######################################################################################
val numbers = List(1, 2, 3, 4, 5, 6)
val oddNumbers = numbers.filter(_ % 2 != 0)
println("oddNumbers = " + oddNumbers);
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
List<Integer> oddNumbers = new ArrayList<Integer>();
for (int number : numbers) {
if (number % 2 != 0)
oddNumbers.add(number);
}
System.out.println("oddNumbers = " + oddNumbers);
class ClassDeclarationSyntaxInScala {
abstract class AbstractDTO(val id: Long)
class CustomerDTO(id: Long, var name: String, var roles: List[String])
extends AbstractDTO(id)
}
public class ClassDeclarationSyntaxInJava {
public abstract class AbstractDTO {
private final Long id;
public AbstractDTO(Long id) {
this.id = id;
}
public Long getId() {
val customersById = new HashMap[String, Customer]
var strings = List ("one", "two", "three")
val profit = new BigInteger("12345678.99")
Map<String, Customer> customersById = new HashMap<String, Customer>();
List<String> strings = Arrays.asList("one", "two", "three");
BigInteger profit = new BigInteger("12345678.99");
@stephanos
stephanos / gist:3922840
Created October 20, 2012 10:02 — forked from asouza/scala2.10-reflection
Scala 2.10 new Reflection API
import scala.reflect.api._
import scala.reflect.runtime._
import scala.reflect.runtime.Mirror._
object Pimps {
implicit def pimp(str:String) = new {
def test = println("hello")
}
}
@stephanos
stephanos / dyn.scala
Created October 20, 2012 09:57 — forked from bartschuller/dyn.scala
Example of Scala's Dynamic trait as implemented in Scala 2.9.0 with scalac -Xexperimental
class ListBuilder extends Dynamic {
private var res = List[String]()
def applyDynamic(method: String)(args: Any*) = {
val argString = if (args.length>0) "(" + args.mkString(" ") + ")" else ""
res = method + argString :: res
this
}
def result = res.reverse