Responsible for servicing mobile clients' search requests. Involves issuing HTTP request to the Search Service (for ids) and then to individual services (Video Service, Movie Service) for full objects.
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
module Timeout where | |
import Control.Concurrent (threadDelay) | |
import System.Timeout (timeout) | |
onesecond = 1000000 | |
timeoutmax = onesecond * 2 | |
delay = timeoutmax * 2 -- timer will expire before delay ends |
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 slick.driver.MySQLDriver.simple._ | |
import scala.slick.collection.heterogenous._ | |
import scala.slick.collection.heterogenous.syntax._ | |
import scala.slick.jdbc._ | |
// This is the large case class we are mapping -- 25 string fields: | |
case class BigData( | |
field1: String, | |
field2: String, | |
field3: String, |
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
// Please comment in case of typos or bugs | |
import scala.slick.driver.H2Driver._ | |
val db = Database.for...(...) | |
case class Record( ... ) | |
class Records(tag: Tag) extends Table[Record](tag,"RECORDS"){ | |
... | |
def * = ... <> (Record.tupled,Record.unapply) | |
// place additional methods here which return values of type Column |
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
module Main where | |
data Foo = Foo | |
{ x :: String | |
, y :: String | |
, z :: String | |
} deriving (Show) | |
q = Foo "one" "two" "three" -- Foo {x = "one", y = "two", z = "three"} |
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
var async = require('async'); | |
var _ = require('lodash'); | |
var $ = require('./utilities.js'); | |
////////////////////////////////////////////////// | |
// two simple unary functions, for demonstration | |
// purposes | |
function dubble(x) { | |
return x * 2; |
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
#!/bin/bash | |
echo "Running diffs against responses from service at: $1" | |
for run in {1..9999} | |
do | |
curl $1/mobile/videos/search?query=Star+Trek\&pageSize=1 | json_pp | diff api-movieclips/test/fixtures/search.json - | |
if [ $? -eq 1 ]; then | |
osascript -e 'display notification "MovieClips API Video Search call failed" with title "MovieClips API Failure"' | |
fi |
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
{ | |
"navigation" : [ | |
{ | |
"dateUpdated" : "2015-06-02T23:05:47.760Z", | |
"mature" : null, | |
"description" : null, | |
"dateTerminated" : null, | |
"image" : null, | |
"keywords" : null, | |
"videos" : [ |
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
async.parallel({ | |
'alpha': function(callback) { | |
window.setTimeout(function() { | |
callback(null, 0); | |
}, 1000); | |
}, | |
'beta': function(callback) { | |
window.setTimeout(function() { | |
callback(null, 1, 2); | |
}); |