This file contains 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
{ | |
"id": "100", | |
"email": "bigjasonwebb@gmail.com", | |
"realName": "Jason J Webb", | |
"avatar": "/100/C0F6B65E73BE49BAA9F940E40550917E.jpg", | |
"signupDate": "2014-02-11T23:21:01+00:00", | |
"featureEnrollments": [ | |
{ | |
"id": 1, | |
"feature": "publish", |
This file contains 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
{ | |
"id": "CFF5C6158BFD45C9A53459FBAB9996B2", | |
"delta": "44", | |
"isDeleted": false, | |
"revisions": [ | |
{ | |
"revisionId": 44, | |
"userId": 100, | |
"date": { | |
"time": "2014-07-17T22:58:12+00:00", |
This file contains 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
{ | |
"id": "FFF5C6158BFD45C9A53459FBAB9996B2", | |
"delta": "41", | |
"isDeleted": false, | |
"revisions": [ | |
{ | |
"revisionId": 41, | |
"userId": 100, | |
"date": { | |
"time": "2014-07-17T04:37:16+00:00", |
This file contains 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
{ | |
"id": "FFF5C6158BFD45C9A53459FBAB9996B2", | |
"delta": "41", | |
"isDeleted": false, | |
"revisions": [ | |
{ | |
"revisionId": 41, | |
"userId": 100, | |
"date": { | |
"time": "2014-07-17T04:37:16+00:00", |
This file contains 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
{ | |
"code": 500, | |
"error": "There was an unexpected server error.", | |
"fields": null | |
} |
This file contains 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 save[A](key: String)(f: CouchValueHandler[A])(implicit formatter: CouchFormat[A], context: CouchContext): Future[A] = | |
get[A](key).flatMap { | |
case Some(row) => | |
update[A](key, row)(value => f(value.some)) | |
case None => | |
val value = f(None) | |
add(key, value) flatMap { | |
case false => // Failure to add means there is now a value, start the process over. | |
save(key)(f) | |
case true => |
This file contains 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
/** | |
* Copyright (C) 2006-2009 Dustin Sallings | |
* Copyright (C) 2009-2013 Couchbase, Inc. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: |
This file contains 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 EntryMasterSerializer { | |
def EntryProposedRevisionReader(entryId: UUID)(implicit request: DayOneAuthenticatedRequest[_]): Reads[(ProposedRevision, Entry)] = ( | |
(__ \ "type").read[RevisionOutcome] and | |
(__ \ "editDate").readOrElse(DateTime.now(DateTimeZone.UTC)) and | |
(__ \ "entry").read(entryReads(entryId.some)) | |
).tupled.map { | |
case (outcome, editDate, entry) => | |
val revision = ProposedRevision( | |
outcome = outcome, | |
user = request.user, |
This file contains 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 EntryMerge(em: EntryMaster, | |
revisionIn: ProposedRevision, | |
entryIn: Entry, | |
parentRevision: Option[EntryRevision]) extends Loggable with DayOneInjectable { | |
// CODE AND THINGS! | |
} |
This file contains 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
var decodeBase64 = (function(b64) { | |
var i, j, l, tmp, scratch, arr = []; | |
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | |
if (typeof b64 !== 'string') { | |
throw 'Input is not a string'; | |
} | |
if (b64.length % 4 > 0) { | |
throw 'Invalid base64 source.'; | |
} | |
scratch = b64.indexOf('='); |