- Solve all problems using JavaScript
-
Write a function that returns an array with the first
n
powers of 2. Call ittwoPow
. -
Use
twoPow
andArray.prototype.reduce
to the sum of the first 10 powers of 2. -
Describe this call signature:
// Handles JavaScript history management and callbacks. To use, register a | |
// regexp that matches the history hash with its corresponding callback. | |
window.HashHistory = { | |
// The interval at which the window location is polled. | |
URL_CHECK_INTERVAL : 500, | |
// We need to use an iFrame to save history if we're in an old version of IE. | |
USE_IFRAME : jQuery.browser.msie && jQuery.browser.version < 8, |
// For each of the following code fragments: | |
// a. what does the code do? | |
// b. what did the author intend for it to do? | |
// c. how would you fix it? | |
// NOTE: all code samples work exactly the same in all browsers | |
// 1. object literals | |
var data = [ { high: 100, low: 81 }, { high: 93, low: 73 }, { high: 60, low: 32 } ]; | |
function getAverages(data) { | |
var avgs = []; |
The bridge is now located at https://github.com/fjolnir/TLC |
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <sean@iamseanmurphy.com> |
''' | |
chunked_server_test.py | |
Copyright August 3, 2012 | |
Released into the public domain | |
This implements a chunked server using Python threads and the built-in | |
BaseHTTPServer module. Enable gzip compression at your own peril - web | |
browsers seem to have issues, though wget, curl, Python's urllib2, my own | |
async_http library, and other command-line tools have no problems. |
''' | |
prefix_code.py | |
Copyright 2012-2013 Josiah Carlson | |
Released under the GNU LGPL v 2.1 license | |
This module offers the ability to encode/decode a sequence of integers into | |
strings that can then be used to compare sequences of integers (or paths on | |
trees) quickly. This module was originally intended to be used in a case- | |
preserving index in a relational database (where 'Z' comes before 'a', as is |