$ npm install -g LiveScriptStart LiveScript REPL:
$ lsc -d| {any, tail, fix, concat-map, empty, map, foldr1, id, sqrt, sin, abs} = require \prelude-ls | |
| is-digit = (c) -> 48 <= (c.char-code-at 0) <= 57 | |
| is-space = (c) -> code = c.char-code-at 0 ; [9, 32] |> any (== code) | |
| # the argument of parse-digit, parse-pint and parse-decimal must be a valid parsable string | |
| parse-signed-number = (parser, cs) --> |
| next-i = do -> | |
| j = 1 | |
| (i) -> | |
| success, reject <- new Promise _ | |
| success i + j | |
| spawn = (gen) -> | |
| success, reject <- new Promise _ | |
| next = (last) -> |
| {map, foldr1} = require \prelude-ls | |
| class Plottable | |
| (@continuations, @options, @_plotter) -> | |
| plotter: ({result, view}) ~> | |
| @_plotter @continuations, @options, {result, view} | |
| timeseries = new Plottable do | |
| (chart, callback) -> callback null, chart # noop continuation |
| map $query_string $new_url { | |
| ~a=1 http://www.gov.uk/1; | |
| ~a=2 http://www.gov.uk/2; | |
| ~a=3&b=1|b=1&a=3 http://www.gov.uk/31; | |
| ~\ba=4\b.*\bb=2\b|\bb=2\b.*\ba=4\b http://www.gov.uk/42; | |
| } | |
| server { | |
| server_name lrc.businesslink.gov.uk; |
| unit = (x) -> new Promise (resolve, reject) -> | |
| resolve x | |
| # or just unit = -> Promise.resolve it | |
| double = (x) -> new Promise (resolve, reject) -> | |
| <- set-timeout _, 500 | |
| resolve 2 * x | |
| square-root = (x) -> new Promise (resolve, reject) -> |
| #!/Users/homam/dev/LiveScript/bin/lsc | |
| {map, filter, id, concat-map, empty, find, any, intersection, zip, drop, take, maximum} = require \prelude-ls | |
| trace = -> console.log it; it | |
| json = -> JSON.stringify it, null, 2 | |
| emit = ({i, value}) -> | |
| { | |
| i | |
| value: if (do -> any do |
For a well targeted campaign, σ of revenues for each subscriber is small:
$$
Revenue = ARPU \times Subscribers
$$
Hence:
| ## Content API Information | |
| ### User Authentication | |
| You should pass a special header containing the user ID in every API request: `-H "x-userid:3"` | |
| We get the `userid` from _Authentication API_ that is described in another document. | |
| Please use `x-userid:3` for testing purposes. |
| #return json | |
| colors = d3.scale.category20! | |
| view, result <- id | |
| view.innerHTML = "" | |
| view = | |
| d3.select view .append \svg .attr \width, "100%" .attr \height, "100%" .node 0 | |
| window.view = view |