CSS tweaks
Allow pack.js to take a list of files from stdin.

Summary:
This will make it easier to move to the new make framework, which
wants to be able to specify inputs explicitly.

Allow the outfile to be specified explicitly on the commandline.

Again, this is useful to the make system.

Use slice() instead of splice(), to not mutate global state.

Test Plan:
% node build/pack.js questions/7b6LRebCgb4.yaml
questions/7b6LRebCgb4.yaml

% node build/pack.js questions/7b6LRebCgb4.yaml questions/Vi1JK6IYVt8.yaml
questions/7b6LRebCgb4.yaml
questions/Vi1JK6IYVt8.yaml

% node build/pack.js
questions/-4kGMI-qQ3I.yaml
questions/-a_w0_VAo6U.yaml
questions/0JW9P_T4P_Y.yaml
questions/3XOt1fjWKi8.yaml
questions/5-ZFOhHQS68.yaml
questions/7XaftdE_h60.yaml
questions/7b6LRebCgb4.yaml
questions/By-ggTfeuJU.yaml
questions/CEdXvoAv_oM.yaml
questions/CQYELiTtUs8.yaml
questions/D1NubiWCpQg.yaml
questions/IgYUR7aFY-c.yaml
questions/Io9i1JkKgN4.yaml
questions/J97G6BeYW0I.yaml
questions/K57qjYYjgIY.yaml
questions/U2ovEuEUxXQ.yaml
questions/Vi1JK6IYVt8.yaml
questions/VidnbCEOGdg.yaml
questions/WPimvspI0_c.yaml
questions/bm65xCS5ivo.yaml
questions/hJ18CrKU3Zc.yaml
questions/oNgo9bbDi7Q.yaml
questions/ou9YMWlJgkE.yaml
questions/xyAuNHPsq-g.yaml

socrates% build/pack.js questions/-4kGMI-qQ3I.yaml::/var/tmp/foo.js
questions/-4kGMI-qQ3I.yaml => /var/tmp/foo.js

socrates% build/pack.js questions/-4kGMI-qQ3I.yaml
questions/-4kGMI-qQ3I.yaml => questions/-4kGMI-qQ3I.yaml.js

socrates% build/pack.js
questions/-4kGMI-qQ3I.yaml => questions/-4kGMI-qQ3I.yaml.js
questions/-a_w0_VAo6U.yaml => questions/-a_w0_VAo6U.yaml.js
questions/0JW9P_T4P_Y.yaml => questions/0JW9P_T4P_Y.yaml.js
questions/3XOt1fjWKi8.yaml => questions/3XOt1fjWKi8.yaml.js
questions/5-ZFOhHQS68.yaml => questions/5-ZFOhHQS68.yaml.js
questions/7XaftdE_h60.yaml => questions/7XaftdE_h60.yaml.js
questions/7b6LRebCgb4.yaml => questions/7b6LRebCgb4.yaml.js
questions/By-ggTfeuJU.yaml => questions/By-ggTfeuJU.yaml.js
questions/CEdXvoAv_oM.yaml => questions/CEdXvoAv_oM.yaml.js
questions/CQYELiTtUs8.yaml => questions/CQYELiTtUs8.yaml.js
questions/D1NubiWCpQg.yaml => questions/D1NubiWCpQg.yaml.js
questions/IgYUR7aFY-c.yaml => questions/IgYUR7aFY-c.yaml.js
questions/Io9i1JkKgN4.yaml => questions/Io9i1JkKgN4.yaml.js
questions/J97G6BeYW0I.yaml => questions/J97G6BeYW0I.yaml.js
questions/K57qjYYjgIY.yaml => questions/K57qjYYjgIY.yaml.js
questions/U2ovEuEUxXQ.yaml => questions/U2ovEuEUxXQ.yaml.js
questions/Vi1JK6IYVt8.yaml => questions/Vi1JK6IYVt8.yaml.js
questions/VidnbCEOGdg.yaml => questions/VidnbCEOGdg.yaml.js
questions/WPimvspI0_c.yaml => questions/WPimvspI0_c.yaml.js
questions/bm65xCS5ivo.yaml => questions/bm65xCS5ivo.yaml.js
questions/hJ18CrKU3Zc.yaml => questions/hJ18CrKU3Zc.yaml.js
questions/oNgo9bbDi7Q.yaml => questions/oNgo9bbDi7Q.yaml.js
questions/ou9YMWlJgkE.yaml => questions/ou9YMWlJgkE.yaml.js
questions/xyAuNHPsq-g.yaml => questions/xyAuNHPsq-g.yaml.js

meta.856 [argv] socrates% build/pack.js
questions/-4kGMI-qQ3I.yaml => questions/-4kGMI-qQ3I.yaml.js
questions/-a_w0_VAo6U.yaml => questions/-a_w0_VAo6U.yaml.js
questions/0JW9P_T4P_Y.yaml => questions/0JW9P_T4P_Y.yaml.js
questions/3XOt1fjWKi8.yaml => questions/3XOt1fjWKi8.yaml.js
questions/5-ZFOhHQS68.yaml => questions/5-ZFOhHQS68.yaml.js
questions/7XaftdE_h60.yaml => questions/7XaftdE_h60.yaml.js
questions/7b6LRebCgb4.yaml => questions/7b6LRebCgb4.yaml.js
questions/By-ggTfeuJU.yaml => questions/By-ggTfeuJU.yaml.js
questions/CEdXvoAv_oM.yaml => questions/CEdXvoAv_oM.yaml.js
questions/CQYELiTtUs8.yaml => questions/CQYELiTtUs8.yaml.js
questions/D1NubiWCpQg.yaml => questions/D1NubiWCpQg.yaml.js
questions/IgYUR7aFY-c.yaml => questions/IgYUR7aFY-c.yaml.js
questions/Io9i1JkKgN4.yaml => questions/Io9i1JkKgN4.yaml.js
questions/J97G6BeYW0I.yaml => questions/J97G6BeYW0I.yaml.js
questions/K57qjYYjgIY.yaml => questions/K57qjYYjgIY.yaml.js
questions/U2ovEuEUxXQ.yaml => questions/U2ovEuEUxXQ.yaml.js
questions/Vi1JK6IYVt8.yaml => questions/Vi1JK6IYVt8.yaml.js
questions/VidnbCEOGdg.yaml => questions/VidnbCEOGdg.yaml.js
questions/WPimvspI0_c.yaml => questions/WPimvspI0_c.yaml.js
questions/bm65xCS5ivo.yaml => questions/bm65xCS5ivo.yaml.js
questions/hJ18CrKU3Zc.yaml => questions/hJ18CrKU3Zc.yaml.js
questions/oNgo9bbDi7Q.yaml => questions/oNgo9bbDi7Q.yaml.js
questions/ou9YMWlJgkE.yaml => questions/ou9YMWlJgkE.yaml.js
questions/xyAuNHPsq-g.yaml => questions/xyAuNHPsq-g.yaml.js
meta.857 [argv] socrates% build/pack.js questions/3XOt1fjWKi8.yaml
questions/3XOt1fjWKi8.yaml => questions/3XOt1fjWKi8.yaml.js

Reviewers: desmond

Reviewed By: desmond

CC: alpert

Differential Revision: http://phabricator.khanacademy.org/D4554
Revive Socrates

Summary:
Socrates was actually pretty healthy, he just had a few small misconfigurations of KathJax.  Also, I had to disable the automatic setting of socratesAvailable/socratesEnabled because:

```
// We used to set these to true automatically after the Socrates
// questions were loaded, but now we set them to the state they should
// be, before loading the questions (in
// video-addons.js~VideoPlayerModel._handleResults()).  We can do this
// because the video model has a "hasQuestions" attribute.  There is a
// small chance that the caller could set these 2 variables to true,
// and then this init fails.  There is currently no recovery path from
// that scenario, so it would probably result in some JS errors and
// would require a page refresh to fix.
```

I will link the review to the experiments shortly.

Test Plan:
Locally, hit these URLs:
/math/arithmetic/fractions/Equivalent_fractions/v/equivalent-fractions
/math/arithmetic/fractions/understanding_fractions/v/numerator-and-denominator-of-a-fraction
/science/healthcare-and-medicine/the-heart/heart-introduction/v/flow-through-the-heart
/science/physics/forces-newtons-laws/newtons-laws-of-motion/v/newton-s-1st-law-of-motion
/science/physics/forces-newtons-laws/newtons-laws-of-motion/v/newton-s-first-law-of-motion

Play around with the questions, they seem to be working.

Reviewers: desmond

CC: jace

Differential Revision: http://phabricator.khanacademy.org/D5224
Prefer window to require(), export to all available outputs.

Summary:
Now that we're using `require()` in the browser, it's no longer safe to assume
that if `module.exports` is present, that we don't still want the variable to be
exported to the Socrates namespace.

This will prefer to retrieve variables from the global namespace if they're
present, and will export to both `module.exports` and `Socrates` if they're both
present.

Test Plan: See test plan on {D5605}

Reviewers: mattfaus

Reviewed By: mattfaus

CC: desmond

Differential Revision: http://phabricator.khanacademy.org/D5603
Require(analytics.js) to get socrates questions working again

Apparently the changes introduced by http://phabricator.khanacademy.org/D5439 caused the global Analytics variable to no longer be available in the socrates.js namespace.  So, I added this line to pul

Fixes T2048 (which also contains more details about the problem encountered)

Auditors: jace

Test Plan:
1. Launch local dev appserver
2. Visit http://127.0.0.1:8080/science/healthcare-and-medicine/the-heart/heart-introduction/v/flow-through-the-heart
3. Verify that questions can be answered, or skipped via the 3 mechanisms: submit, skip, or the X in the top-right.
Reverting Socrates Revival experiment

Reverting http://phabricator.khanacademy.org/D5226
See https://docs.google.com/a/khanacademy.org/document/d/1UQECMUQ5Qbsx07uePzI5xuu2sjOUr_QCo2_1nEMWR-o/edit# for a write-up of results.

Auditors: jace, benjaminhaley

Test Plan:
1. visit http://127.0.0.1:8080/math/arithmetic/fractions/Equivalent_fractions/v/equivalent-fractions
2. Notice that Options -> Embedded questions is defaulted to OFF
3. Turn embedded questions on, see that they show up correctly.
4. Let the video play to a question, answer it.
5. Click the question mark icon for one of the questions, answer it.

Everything works!
Always use relative time positioning based on the original video's duration

Summary:
This approach isn't great because we'll have to do some math when crafting experimental Socrates.yaml files to make sure the questions line up where we want them to across all videos.  If the placement of the question can be loose (+/- 2 seconds) it will be easy to calculate.  If you need to place the question very exactly (<1 second), it will be very difficult.

Here are some other approaches I considered.  This is approach #3.

1) Separate socrates.yaml files for each alternative
PRO: YAML files are easy to create
PRO: No new rendering/triggering logic required
CON: Need to create a YAML file for every alternative
CON: Have to route new logic into Socrates question loading so it loads the questions for the correct alternative

2) Add relative timestamps to YAML definitions
PRO: YAML files are less magical since it is explicitly relative
CON: YAML files, keyed by youtube_id, will be associated with multiple videos
CON: We'd have to edit all existing YAML files to switch to relative timestamps to have them work with experimental alternatives
CON: A lot of logic changes required to Socrates to understand these new timestamps

3) Always compute timestamps relative to displayed video duration
PRO: Zero changes to YAML files required.  We could re-use all existing YAML files to run experiments on existing videos.
CON: The timestamp definition in the YAML file would be confusing
CON: YAML files, keyed by youtube_id, will be associated with multiple videos
CON: Have to add new async deferred logic to render/trigger questions only after the video has started playing.  Alternatively, we could start/stop the video very quickly when the page loads, so that we can get the duration.

We also discussed this in HipChat Analytics room earlier today.

Test Plan:
For alternatives:
1. Control previewed at http://127.0.0.1:8080/gae_bingo
2. Alternative previewed at http://127.0.0.1:8080/gae_bingo

and scenarios:
1. Serverside rendering by loading http://127.0.0.1:8080/math/arithmetic/fractions/Equivalent_fractions/v/equivalent-fractions
2. Clientside rendering by loading http://127.0.0.1:8080/math/arithmetic/fractions/Equivalent_fractions/v/equivalent-fractions-example and then clicking on the Equivalent Fractions node

Verify that the video and questions load and display correctly for all combinations.

Reviewers: benjaminhaley, jace, tom

CC: eliana, tony, desmond

Maniphest Tasks: T2054

Differential Revision: http://phabricator.khanacademy.org/D5626
Fix typo

Thanks @Rishi81!