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
int controllerForEfficientHandlingOfStrings; | |
int controllerForEfficientStorageOfStrings; |
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
int a = 1; | |
int l = 2; // lowercase L | |
if (a == l) // intention was to compare 'a' with lowercase L | |
// do something... |
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
int MAX_STUDENT_IN_CLASS = 7; |
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
String accountFirstName; | |
String accountLastName; | |
String billingFirstName; | |
String billingLastName; | |
// VS. | |
String firstName1; | |
String lastName1; | |
String firstName2; |
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
class Address { | |
String firstName; | |
String lastName; | |
... | |
} | |
class Account { | |
String firstName; | |
String lastName; | |
Address billingAddress; | |
... |
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
@With({Authenticated.class, Notifications.class}) | |
public static Result eventDetails(String eventKey) { | |
// do something | |
} |
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
def eventDetails(eventKey: String) = Authenticated andThen | |
WithNotifications async { implicit request => | |
// Events.findEventByKey returns Future[Event] | |
Events.findEventByKey(eventKey) map { event => | |
Ok(eventDetails(request.user, request.notifications, event)) | |
} | |
} |
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
def myAction = DoSomething andThen DoAnotherThing [… andThen DoAnotherThing …] { | |
// request.someData and request.someOtherData are available here | |
} |
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 Authenticate extends ActionBuilder[AuthRequest] { | |
def invokeBlock[A]( | |
request: Request[A], | |
block: (AuthRequest[A]) => Future[Result] | |
) = block(AuthRequest(findUserFrom(cookie), request)) | |
} | |
case class AuthRequest[A]( |
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 FetchNotifications | |
extends ActionTransformer[AuthRequest, NotificationRequest] { | |
def transform[A](request: AuthRequest[A]) = Future { | |
request.user.map { user => | |
NotificationRequest[A](Some(user), findNotificationsByUser(user), request) | |
} getOrElse { | |
NotificationRequest[A](None, None, request) | |
} | |
} |