This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.squeryl | |
import annotations.Transient | |
import java.lang.reflect.Field | |
/** | |
* @author Yaroslav Klymko | |
*/ | |
trait HasValues { | |
protected def values: List[Any] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-surefire-plugin</artifactId> | |
<version>2.8</version> | |
<configuration> | |
<systemProperties> | |
<property> | |
<name>run.mode</name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait BasicAuthentication extends Loggable{ | |
self: Actor => | |
protected def authorize(rec: Receive): Receive = if (Props.testMode) rec | |
else new Receive { | |
def apply(v: Any) { | |
v match { | |
case method: RequestMethod => method.request.getHeader("Authorization") match { | |
case BasicAuth(login, password) if (authorized_?(login, password)) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scala | |
/** | |
* @author Yaroslav Klymko | |
*/ | |
object StringOption { | |
def apply(s: String): Option[String] = s match { | |
case null | "" => None | |
case _ => Some(s) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thenewmotion.chargenetwork.server.services.proto | |
import akka.actor._ | |
import akka.actor.Actor._ | |
import akka.routing._ | |
import akka.event.EventHandler | |
/** | |
* @author Yaroslav Klymko | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JavaClass { | |
public String toString() { | |
return "" | |
} | |
public boolean getBool() { | |
return false | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val func = (req: HttpServletRequest) => { | |
// ASYNC SCOPE | |
// heavy scope, actually this is a place async is needed for | |
// async request might expire | |
(res: HttpServletResponse) => { | |
// RESPONSE SCOPE | |
// lite scope for putting collected data to response, called if not expired | |
(result: Boolean) => { | |
// CALLBACK SCOPE | |
// called to notify whether response sent successfully |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ConnectorTypes extends Table[(String, ConnectorType.Value)]("connector_type") { | |
implicit val ConnectorTypeMapper = new EnumMappedTypeMapper(ConnectorType) | |
def chargerId = column[String]("charger_id") | |
def connectorType = column[ConnectorType.Value]("connector_type") | |
def * = chargerId ~ connectorType | |
def ux = index("ux_connector_type", chargerId ~ connectorType, unique = true) | |
def fkCharger = foreignKey("fk_connector_types_charger", chargerId, Charger)(_.id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object blog { | |
object events { | |
sealed trait PostEvent | |
case class PostCreated(title: String) extends PostEvent | |
case class PostRenamed(id: Long, name: String) extends PostEvent | |
class EventStream() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Yaroslav Klymko | |
*/ | |
object Primes { | |
val naturals = { | |
def loop(n: Long): Stream[Long] = n #:: loop(n + 1) | |
loop(1) | |
} | |
val primes: Stream[Long] = { |
OlderNewer