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
/*============================================================================== | |
User stories from the use cases | |
As a user | |
I want to create organizations | |
So that members have shared access to focussets. | |
As an organization admin | |
I want to have teams within an organization |
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
// Current user document at db | |
{ | |
"_id" : ObjectId("52cc806be4b0f7c7eaff1586"), | |
"account_id" : "50fda274e4b05ced2d767108", | |
"api_key" : "lI8VkQXHO7CPcgpDjI1hfj7HPKYvznqe", | |
"datasift_sample" : 15, | |
"deleted_keywords" : [ ], | |
"email" : "[email protected]", | |
"enabled" : true, |
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
import java.io.File | |
import sbt._ | |
import Keys._ | |
object EkhoBuild extends Build { | |
lazy val root = Project("root", file(".")).dependsOn(ekhoFramework) | |
// Github dependencies | |
lazy val ekhoFramework = RootProject( |
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 listQueryHistogram(username: String, focussetId: String) = | |
(ekhoAuth(GET, Some(username), Some(focussetId)) & | |
params & | |
parameters('queries) & | |
detach()) | |
{ | |
// The first two are the values extracted by params and parameterers directives | |
(params, queries) => ctx => | |
val theList = queries.split(",").toList |
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
case class Pet(name: String, kind: String) | |
case class Owner(name: String, pets: List[Pet]) | |
implicit def toOwner(doc: foos.T) = Owner( | |
name = doc.as[String]("name"), | |
pets = doc.as[MongoDBList]("pets").map(_.asInstanceOf[BasicDBObject]).map { p => | |
Pet(p.as[String]("name"), p.as[String]("kind")) | |
} toList | |
) |
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
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"account": { | |
"type": "object", | |
"properties": { | |
"account_type": { "enum": [ "individual", "organization" ] | |
}, | |
"name": { "type": "string" }, | |
"email": { "type": "string", "format": "email" }, |
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 payload = """ | |
{ | |
aug_weights: { | |
interest: 0.20, | |
impact: 0.0, | |
emotion: 0.10, | |
opinion: 0.0 | |
}, | |
terms_and_weights: [ | |
{ |
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
curl http://10.229.48.35:8282/people \ | |
--request POST \ | |
--header "Content-Type: application/json" \ | |
--data-binary ' | |
{ | |
"focusset_id": "54760a5ae4b04f6a80bde81a", | |
"from_date": "1416729600000", | |
"to_date": "1424200529143", | |
"ekhoscore_data": { | |
"aug_weights": { |
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
# http://code.tutsplus.com/tutorials/mass-assignment-rails-and-you--net-31695 | |
# Given the mass asignment: | |
attrs = {:first => "John", :last => "Doe", :email => "[email protected]"} | |
user = User.new(attrs) | |
user.first #=> "John" | |
user.last #=> "Doe" | |
user.email #=> "[email protected]" |
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
# Given an user | |
@user = Article.new(params[:user]) | |
# Bad | |
logger.debug "New user: #{@user.attributes.inspect}" | |
# Good | |
logger.debug "New user: #{@user.attributes.id}" |
OlderNewer