Skip to content

Instantly share code, notes, and snippets.

@laser
laser / mobile.md
Last active August 29, 2015 14:21
Mobile API Contracts

Mobile Search

Q: When someone performs a "search video title" - what kind of information should they expect to get back? The designs show: thumbnail, video title, video alternate title (implicit: video id and...?). A:

Q: If I search for "fast" and I have a video with the title "Great Trailer" and alternative title "Great Trailer Alt" and is associated with movie "Fast and Furious" - does that video show up in my search results?

Q: Should the API consumer be able to provide a value indicating the maximum number of search results to return? A:

@laser
laser / response.json
Created May 15, 2015 17:26
mc response
{
"navigation" : [
{
"dateUpdated" : "2015-02-18T07:02:07.640Z",
"mature" : null,
"description" : null,
"dateTerminated" : null,
"image" : null,
"keywords" : null,
"videos" : [
function create(req, res, next) {
Placement.create(req.body, function (err, placement) {
if (err) {
if (err instanceof RecordNotFound) {
res.status(status(404)).send();
}
else if (err instanceof ValidationFailed) {
res.status(status(400)).send();
}
else {
@laser
laser / client.js
Last active August 29, 2015 14:21
swagger client wrapper
var client = require("swagger-client");
var Promise = require("bluebird");
var _ = require('lodash');
function ServiceClient(url) {
this.swagger = new Promise(function (resolve, reject) {
var c = new client({
url: url + '/swagger.json',
success: function() {
var iface = _.reduce(c.apis, function(acc, v, k) {
@laser
laser / exec.js
Created April 29, 2015 23:28
Variadic `exec` call
/* @flow */
var exec = require('child_process').exec;
exec('ls', function(err, line) {
console.log('zomg');
});
@laser
laser / AParserSpec.hs
Created April 22, 2015 20:12
runhaskell AParserSpec.hs
import Test.Hspec
import Test.QuickCheck
import AParser
import Control.Applicative
main :: IO ()
main = hspec $ do
describe "first" $ do
it "should work" $ do
first (*2) (10, 10) `shouldBe` (20, 10)
var PersonView = React.createClass({
getInitialState: function() {
return { name: 'Erin', age: 32 };
},
componentDidMount: function() {
setTimeout(function() {
this.setState({ age: 33 });
}.bind(this), 1000);
},
render: function() {
@laser
laser / throw-ERror.txt
Created April 20, 2015 21:34
throw stuff
/Users/erinswenson-healey/dev/TARS/src/server.js:51
throw foo();
^
Error: Oh noes!
at bliz (/Users/erinswenson-healey/dev/TARS/src/server.js:41:18)
at bar (/Users/erinswenson-healey/dev/TARS/src/server.js:44:16)
at foo (/Users/erinswenson-healey/dev/TARS/src/server.js:47:14)
at Object.module.exports.start (/Users/erinswenson-healey/dev/TARS/src/server.js:51:11)
at Object.<anonymous> (/Users/erinswenson-healey/dev/TARS/start.js:5:8)
at Module._compile (module.js:456:26)
@laser
laser / install.log
Created April 11, 2015 20:01
isomorphic500 install log
~/dev/isomorphic500 [master|…1]
13:00 $ ls
LICENSE config npm-debug.log public test
README.md index.js package.json src webpack
~/dev/isomorphic500 [master|…1]
13:00 $ npm install
> [email protected] install /Users/erinswenson-healey/dev/isomorphic500/node_modules/babel/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild