id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jianliaoim/talk-os:talk-account/client/entry/template.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Page, React, ReactDOM, assetLinks, baidu, body, config, div, fs, googleAnalytics, head, html, link, locales, meta, mixpanel, path, script, stir, title;
fs = require('fs');
path = require('path');
stir = require('stir-template');
React = require('react');
c... | fs = require 'fs'
path = require 'path'
stir = require 'stir-template'
React = require 'react'
config = require 'config'
ReactDOM = require 'react-dom/server'
locales = require '../locales'
assetLinks = require '../packing/asset-links'
{html, head, title, meta, link, script, body, div} = stir
Page = React.createFact... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/entry/template.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/template.coffee | 1 | 44 |
jianliaoim/talk-os:talk-account/client/entry/template.coffee:1:completion | completion | fs = require 'fs'
path = require 'path'
stir = require 'stir-template'
React = require 'react'
config = require 'config'
ReactDOM = require 'react-dom/server'
locales = require '../locales'
assetLinks = require '../packing/asset-links'
{html, head, title, meta, link, script, body, div} = stir
Page = React.createFact... | stir.render stir.doctype(),
html null,
head null,
title null, locales.get('jianliao', language)
meta charset: 'utf-8'
meta 'http-equiv': 'X-UA-Compatible', content: 'IE=edge, chrome=1'
meta name: 'referrer', content: 'origin-when-cross-origin'
meta name: 'superfish', co... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/client/entry/template.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/client/entry/template.coffee | 1 | 44 |
soyjavi/QuoJS:src/quo2.core.coffee:1:raw_corpus | raw_corpus | (($$) ->
EMPTY_ARRAY = [ ]
OBJECT_PROTOTYPE = Object::
$$.toType = (obj) ->
OBJECT_PROTOTYPE.toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()
$$.isOwnProperty = (object, property) ->
OBJECT_PROTOTYPE.hasOwnProperty.call object, property
$$.getDomainSelector = (selector... | CoffeeScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 1 | 40 | ||
soyjavi/QuoJS:src/quo2.core.coffee:1:completion | completion | (($$) ->
EMPTY_ARRAY = [ ]
OBJECT_PROTOTYPE = Object::
$$.toType = (obj) ->
OBJECT_PROTOTYPE.toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()
$$.isOwnProperty = (object, property) ->
OBJECT_PROTOTYPE.hasOwnProperty.call object, property
$$.getDomainSelector = (selector... | else if elementTypes.indexOf(selector.nodeType) >= 0 or selector is window
domain = [selector]
selector = null
domain
$$.map = (elements, callback) ->
values = []
i = undefined
key = undefined
if $$.toType(elements) is "array"
i = 0
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 1 | 40 |
soyjavi/QuoJS:src/quo2.core.coffee:2:raw_corpus | raw_corpus | $$.each = (elements, callback) ->
i = undefined
key = undefined
if $$.toType(elements) is "array"
i = 0
while i < elements.length
return elements if callback.call(elements[i], i, elements[i]) is false
i++
else
for key o... | CoffeeScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 42 | 79 | ||
soyjavi/QuoJS:src/quo2.core.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$$.each = (elements, callback) ->
i = undefined
key = undefined
if $$.toType(elements) is "array"
i = 0
while i < elements.length
return elements if callback.call(elements[i], i, elements[i]) is fal... | $$.each = function(elements, callback) {
var i, key;
i = void 0;
key = void 0;
if ($$.toType(elements) === "array") {
i = 0;
while (i < elements.length) {
if (callback.call(elements[i], i, elements[i]) === false) {
return elements;
}
i++;
}
} else {
for (key in elemen... | CoffeeScript | JavaScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 42 | 79 |
soyjavi/QuoJS:src/quo2.core.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
$$.each = function(elements, callback) {
var i, key;
i = void 0;
key = void 0;
if ($$.toType(elements) === "array") {
i = 0;
while (i < elements.length) {
if (callback.call(elements[i], i, elements[i]) === false) {
return elements;
... | $$.each = (elements, callback) ->
i = undefined
key = undefined
if $$.toType(elements) is "array"
i = 0
while i < elements.length
return elements if callback.call(elements[i], i, elements[i]) is false
i++
else
for key o... | JavaScript | CoffeeScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 42 | 79 |
soyjavi/QuoJS:src/quo2.core.coffee:2:completion | completion | $$.each = (elements, callback) ->
i = undefined
key = undefined
if $$.toType(elements) is "array"
i = 0
while i < elements.length
return elements if callback.call(elements[i], i, elements[i]) is false
i++
else
for key o... | argument = arguments[arg]
for prop of argument
child[prop] = argument[prop] if $$.isOwnProperty(argument, prop) and argument[prop] isnt `undefined`
arg++
child
$$.fn.map = (fn) ->
$$.map this, (el, i) -> fn.call el, i, el
$$.fn.instance = (property) ->
... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 42 | 79 |
soyjavi/QuoJS:src/quo2.core.coffee:3:raw_corpus | raw_corpus | _compact = (array) ->
array.filter (item) ->
item isnt undefined and item isnt null
_flatten = (array) ->
(if array.length > 0 then [].concat.apply([], array) else array)
) Quo | CoffeeScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 82 | 89 | ||
soyjavi/QuoJS:src/quo2.core.coffee:3:completion | completion | _compact = (array) ->
array.filter (item) ->
item isnt undefined and item isnt null | _flatten = (array) ->
(if array.length > 0 then [].concat.apply([], array) else array)
) Quo | CoffeeScript | CoffeeScript | soyjavi/QuoJS | src/quo2.core.coffee | MIT | 614f5925ddf2055d34da9c812e1a59c75f9266fd | 2,055 | https://github.com/soyjavi/QuoJS/blob/614f5925ddf2055d34da9c812e1a59c75f9266fd/src/quo2.core.coffee | 82 | 89 |
jianliaoim/talk-os:talk-api2x/server/syncers/github.coffee:1:raw_corpus | raw_corpus | Err = require 'err1st'
Promise = require 'bluebird'
request = require 'request'
class Github
expire: 86400
category: 'github'
getTeamList: (user, tbAlien) ->
{openId, token} = tbAlien
options =
method: 'GET'
url: "https://api.github.com/users/#{openId}/orgs"
json: true
headers:... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/syncers/github.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/syncers/github.coffee | 1 | 27 | ||
jianliaoim/talk-os:talk-api2x/server/syncers/github.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Err = require 'err1st'
Promise = require 'bluebird'
request = require 'request'
class Github
expire: 86400
category: 'github'
getTeamList: (user, tbAlien) ->
{openId, token} = tbAlien
options =
method: 'GET'
url: "https://api.github.... | var Err, Github, Promise, request;
Err = require('err1st');
Promise = require('bluebird');
request = require('request');
Github = (function() {
class Github {
getTeamList(user, tbAlien) {
var openId, options, token;
({openId, token} = tbAlien);
options = {
method: 'GET',
url:... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/syncers/github.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/syncers/github.coffee | 1 | 27 |
jianliaoim/talk-os:talk-api2x/server/syncers/github.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Err, Github, Promise, request;
Err = require('err1st');
Promise = require('bluebird');
request = require('request');
Github = (function() {
class Github {
getTeamList(user, tbAlien) {
var openId, options, token;
({openId, token} = tbAlien)... | Err = require 'err1st'
Promise = require 'bluebird'
request = require 'request'
class Github
expire: 86400
category: 'github'
getTeamList: (user, tbAlien) ->
{openId, token} = tbAlien
options =
method: 'GET'
url: "https://api.github.com/users/#{openId}/orgs"
json: true
headers:... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/syncers/github.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/syncers/github.coffee | 1 | 27 |
jianliaoim/talk-os:talk-api2x/server/syncers/github.coffee:1:completion | completion | Err = require 'err1st'
Promise = require 'bluebird'
request = require 'request'
class Github
expire: 86400
category: 'github'
getTeamList: (user, tbAlien) ->
{openId, token} = tbAlien
options = | method: 'GET'
url: "https://api.github.com/users/#{openId}/orgs"
json: true
headers:
Authorization: "token #{token}"
"User-Agent": "jianliao.com"
request options
.spread (res, orgs = []) ->
orgs = orgs.map? (org) ->
name: org.login
sourceId: org.login
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/syncers/github.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/syncers/github.coffee | 1 | 27 |
buttercoin/buttercoin:test/test_pce.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 1 | 50 | ||
buttercoin/buttercoin:test/test_pce.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mo... | var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('ProcessingChainEntrance', function() {
beforeEach(functio... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 1 | 50 |
buttercoin/buttercoin:test/test_pce.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('Proc... | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 1 | 50 |
buttercoin/buttercoin:test/test_pce.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | done()
it 'should log, replicate, and execute a messge upon receiving it', (done) ->
deferred = Q.defer()
deferred.resolve(undefined)
operation = {kind: "TEST"}
messageJson = JSON.stringify(operation)
@journal.expects('record').once().withArgs(messageJson).returns(deferred.promise)
@replicat... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 1 | 50 |
buttercoin/buttercoin:test/test_pce.coffee:2:raw_corpus | raw_corpus | onError = (error) ->
error.name.should.equal "failure"
done()
@pce.forward_operation(null).fail(onError).done() | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 51 | 56 | ||
buttercoin/buttercoin:test/test_pce.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
onError = (error) ->
error.name.should.equal "failure"
done()
@pce.forward_operation(null).fail(onError).done()
``` | var onError;
onError = function(error) {
error.name.should.equal("failure");
return done();
};
this.pce.forward_operation(null).fail(onError).done(); | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 51 | 56 |
buttercoin/buttercoin:test/test_pce.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var onError;
onError = function(error) {
error.name.should.equal("failure");
return done();
};
this.pce.forward_operation(null).fail(onError).done();
``` | onError = (error) ->
error.name.should.equal "failure"
done()
@pce.forward_operation(null).fail(onError).done() | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 51 | 56 |
buttercoin/buttercoin:test/test_pce.coffee:2:completion | completion | onError = (error) ->
error.name.should.equal "failure" | done()
@pce.forward_operation(null).fail(onError).done() | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | b1d617f7a8490397470c19cf86b0c64953d839fa | 663 | https://github.com/buttercoin/buttercoin/blob/b1d617f7a8490397470c19cf86b0c64953d839fa/test/test_pce.coffee | 51 | 56 |
buttercoin/buttercoin:test/test_pce.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | 8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff | 663 | https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/test/test_pce.coffee | 1 | 38 | ||
buttercoin/buttercoin:test/test_pce.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mo... | var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('ProcessingChainEntrance', function() {
beforeEach(functio... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | 8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff | 663 | https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('Proc... | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | 8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff | 663 | https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | it 'should intialize the transaction log and replication when starting', (done) ->
@journal.expects('start').once().returns(then: ->)
@replication.expects('start').once().returns(then: ->)
@pce.start()
done()
it 'should log, replicate, and package a messge upon receiving it', (done) ->
deferred ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | 8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff | 663 | https://github.com/buttercoin/buttercoin/blob/8e9e34e30f6e6a88bcf452c738cb3f4584aa1dff/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c1e15fc3841af44bd188994416f3e4a4a7d46c8f | 663 | https://github.com/buttercoin/buttercoin/blob/c1e15fc3841af44bd188994416f3e4a4a7d46c8f/test/test_pce.coffee | 1 | 38 | ||
buttercoin/buttercoin:test/test_pce.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mo... | var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('ProcessingChainEntrance', function() {
beforeEach(functio... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c1e15fc3841af44bd188994416f3e4a4a7d46c8f | 663 | https://github.com/buttercoin/buttercoin/blob/c1e15fc3841af44bd188994416f3e4a4a7d46c8f/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('Proc... | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c1e15fc3841af44bd188994416f3e4a4a7d46c8f | 663 | https://github.com/buttercoin/buttercoin/blob/c1e15fc3841af44bd188994416f3e4a4a7d46c8f/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | it 'should intialize the transaction log and replication when starting', (done) ->
@journal.expects('start').once().returns(then: ->)
@replication.expects('start').once().returns(then: ->)
@pce.start()
done()
it 'should log, replicate, and package a messge upon receiving it', (done) ->
deferred ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c1e15fc3841af44bd188994416f3e4a4a7d46c8f | 663 | https://github.com/buttercoin/buttercoin/blob/c1e15fc3841af44bd188994416f3e4a4a7d46c8f/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:raw_corpus | raw_corpus | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b | 663 | https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/test/test_pce.coffee | 1 | 38 | ||
buttercoin/buttercoin:test/test_pce.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mo... | var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('ProcessingChainEntrance', function() {
beforeEach(functio... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b | 663 | https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Journal, ProcessingChainEntrance, TradeEngine, kTestFilename;
ProcessingChainEntrance = require('../lib/processingchainentrance');
TradeEngine = require('../lib/trade_engine');
Journal = require('../lib/journal');
kTestFilename = 'test.log';
describe('Proc... | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b | 663 | https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/test/test_pce.coffee | 1 | 38 |
buttercoin/buttercoin:test/test_pce.coffee:1:completion | completion | ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')
kTestFilename = 'test.log'
describe 'ProcessingChainEntrance', ->
beforeEach (done) ->
@journal = sinon.mock(new Journal(kTestFilename))
@replication = sinon.m... | it 'should intialize the transaction log and replication when starting', (done) ->
@journal.expects('start').once().returns(then: ->)
@replication.expects('start').once().returns(then: ->)
@pce.start()
done()
it 'should log, replicate, and package a messge upon receiving it', (done) ->
deferred ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_pce.coffee | MIT | c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b | 663 | https://github.com/buttercoin/buttercoin/blob/c9e9d96291cce9c24bf25dc1dbfe44d03d4c254b/test/test_pce.coffee | 1 | 38 |
kahmali/meteor-restivus:lib/router.coffee:1:raw_corpus | raw_corpus | @Restivus = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 1 | 14 | ||
kahmali/meteor-restivus:lib/router.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
###
``... | this.Restivus = function() {
this.config = {
paths: [],
useAuth: false,
apiPath: '/api',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return this.configured = false;
};
/*
Add endpoints for the giv... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 1 | 14 |
kahmali/meteor-restivus:lib/router.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus = function() {
this.config = {
paths: [],
useAuth: false,
apiPath: '/api',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return this... | @Restivus = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
### | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 1 | 14 |
kahmali/meteor-restivus:lib/router.coffee:1:completion | completion | @Restivus = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true | onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 1 | 14 |
kahmali/meteor-restivus:lib/router.coffee:2:raw_corpus | raw_corpus | @Restivus.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different parameter... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 15 | 64 | ||
kahmali/meteor-restivus:lib/router.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions wit... | this.Restivus.prototype.add = function(path, options, methods) {
var self;
self = this;
path = this.config.apiPath + path;
console.log(`Adding ${_.keys(methods)} methods to path: ${path}`);
// Throw an error if this path has already been added
// TODO: Check for collisions with paths that follow same patter... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.add = function(path, options, methods) {
var self;
self = this;
path = this.config.apiPath + path;
console.log(`Adding ${_.keys(methods)} methods to path: ${path}`);
// Throw an error if this path has already been added
// TODO: ... | @Restivus.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different parameter... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:2:completion | completion | @Restivus.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different parameter... | responseBody = methods.get.call(this)
else if method is 'POST' and methods.post
_.extend this.params, this.request.body
responseBody = methods.post.call(this)
else if method is 'PUT' and methods.put
_.extend this.params, this.request.body
responseBody = methods.put.call(this)... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:4:raw_corpus | raw_corpus | @Restivus.prototype.configure = (config) ->
if this.configured
throw new Error 'Restivus.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if this.config.apiPath[-1] != '/'
this.config.apiPath = this... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 71 | 90 | ||
kahmali/meteor-restivus:lib/router.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restivus.prototype.configure = (config) ->
if this.configured
throw new Error 'Restivus.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if this... | this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Copy the config properties to our global api configuration
_.extend(this.config, config);
if (this.config.apiPath[-1] !== '/') {
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 71 | 90 |
kahmali/meteor-restivus:lib/router.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restivus.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restivus.configure() can only be called once');
}
this.configured = true;
// Copy the config properties to our global api configuration
_.extend(this.config... | @Restivus.prototype.configure = (config) ->
if this.configured
throw new Error 'Restivus.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if this.config.apiPath[-1] != '/'
this.config.apiPath = this... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 71 | 90 |
kahmali/meteor-restivus:lib/router.coffee:4:completion | completion | @Restivus.prototype.configure = (config) ->
if this.configured
throw new Error 'Restivus.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if this.config.apiPath[-1] != '/' | this.config.apiPath = this.config.apiPath + '/'
# Add default login and logout endpoints if auth is configured
if this.config.useAuth
Restivus.initAuth()
###
Verify the request is being made by an actively logged in user
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 71 | 90 |
kahmali/meteor-restivus:lib/router.coffee:5:raw_corpus | raw_corpus | authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken}
# Retur... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 91 | 107 | ||
kahmali/meteor-restivus:lib/router.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 's... | var Restivus, authenticate;
authenticate = function() {
var loginToken, user, userId;
// Get the auth info from header
userId = this.request.headers['x-user-id'];
loginToken = this.request.headers['x-login-token'];
// Get the user from the database
if (userId && loginToken) {
user = Meteor.users.findOn... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 91 | 107 |
kahmali/meteor-restivus:lib/router.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Restivus, authenticate;
authenticate = function() {
var loginToken, user, userId;
// Get the auth info from header
userId = this.request.headers['x-user-id'];
loginToken = this.request.headers['x-login-token'];
// Get the user from the database
if ... | authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken}
# Retur... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 91 | 107 |
kahmali/meteor-restivus:lib/router.coffee:5:completion | completion | authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken} | # Return an error if the login token does not match any belonging to the user
if not user
# TODO: Execute the http error response here
return [403, {success: false, message: "You must be logged in to do this."}]
this.user = user
Restivus = new @Restivus() | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 723f1e02a3be9479b59787ebedbb2f5e2ed4948c | 541 | https://github.com/kahmali/meteor-restivus/blob/723f1e02a3be9479b59787ebedbb2f5e2ed4948c/lib/router.coffee | 91 | 107 |
kahmali/meteor-restivus:lib/router.coffee:1:raw_corpus | raw_corpus | @Restfully = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 1 | 14 | ||
kahmali/meteor-restivus:lib/router.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restfully = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
###
`... | this.Restfully = function() {
this.config = {
paths: [],
useAuth: false,
apiPath: '/api',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return this.configured = false;
};
/*
Add endpoints for the gi... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 1 | 14 |
kahmali/meteor-restivus:lib/router.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restfully = function() {
this.config = {
paths: [],
useAuth: false,
apiPath: '/api',
version: 1,
prettyJson: true,
onLoggedIn: function() {
return {};
},
onLoggedOut: function() {
return {};
}
};
return thi... | @Restfully = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true
onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
### | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 1 | 14 |
kahmali/meteor-restivus:lib/router.coffee:1:completion | completion | @Restfully = ->
this.config =
paths: []
useAuth: false
apiPath: '/api'
version: 1
prettyJson: true | onLoggedIn: -> {}
onLoggedOut: -> {}
this.configured = false
###
Add endpoints for the given HTTP methods at the given path
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 1 | 14 |
kahmali/meteor-restivus:lib/router.coffee:2:raw_corpus | raw_corpus | @Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different paramete... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 15 | 64 | ||
kahmali/meteor-restivus:lib/router.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions wi... | this.Restfully.prototype.add = function(path, options, methods) {
var self;
self = this;
path = this.config.apiPath + path;
console.log(`Adding ${_.keys(methods)} methods to path: ${path}`);
// Throw an error if this path has already been added
// TODO: Check for collisions with paths that follow same patte... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restfully.prototype.add = function(path, options, methods) {
var self;
self = this;
path = this.config.apiPath + path;
console.log(`Adding ${_.keys(methods)} methods to path: ${path}`);
// Throw an error if this path has already been added
// TODO:... | @Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different paramete... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:2:completion | completion | @Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different paramete... | responseBody = methods.get.call(this)
else if method is 'POST' and methods.post
_.extend this.params, this.request.body
responseBody = methods.post.call(this)
else if method is 'PUT' and methods.put
_.extend this.params, this.request.body
responseBody = methods.put.call(this)... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:4:raw_corpus | raw_corpus | @Restfully.prototype.configure = (config) ->
if this.configured
throw new Error 'Restfully.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if this.config.apiPath[-1] != '/'
this.config.apiPath = th... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 71 | 90 | ||
kahmali/meteor-restivus:lib/router.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restfully.prototype.configure = (config) ->
if this.configured
throw new Error 'Restfully.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if th... | this.Restfully.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restfully.configure() can only be called once');
}
this.configured = true;
// Copy the config properties to our global api configuration
_.extend(this.config, config);
if (this.config.apiPath[-1] !== '/') {
... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 71 | 90 |
kahmali/meteor-restivus:lib/router.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restfully.prototype.configure = function(config) {
if (this.configured) {
throw new Error('Restfully.configure() can only be called once');
}
this.configured = true;
// Copy the config properties to our global api configuration
_.extend(this.conf... | @Restfully.prototype.configure = (config) ->
if this.configured
throw new Error 'Restfully.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if this.config.apiPath[-1] != '/'
this.config.apiPath = th... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 71 | 90 |
kahmali/meteor-restivus:lib/router.coffee:4:completion | completion | @Restfully.prototype.configure = (config) ->
if this.configured
throw new Error 'Restfully.configure() can only be called once'
this.configured = true
# Copy the config properties to our global api configuration
_.extend this.config, config
if this.config.apiPath[-1] != '/' | this.config.apiPath = this.config.apiPath + '/'
# Add default login and logout endpoints if auth is configured
if this.config.useAuth
Restfully.initAuth()
###
Verify the request is being made by an actively logged in user
### | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 71 | 90 |
kahmali/meteor-restivus:lib/router.coffee:5:raw_corpus | raw_corpus | authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken}
# Retur... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 91 | 107 | ||
kahmali/meteor-restivus:lib/router.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 's... | var Restfully, authenticate;
authenticate = function() {
var loginToken, user, userId;
// Get the auth info from header
userId = this.request.headers['x-user-id'];
loginToken = this.request.headers['x-login-token'];
// Get the user from the database
if (userId && loginToken) {
user = Meteor.users.findO... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 91 | 107 |
kahmali/meteor-restivus:lib/router.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Restfully, authenticate;
authenticate = function() {
var loginToken, user, userId;
// Get the auth info from header
userId = this.request.headers['x-user-id'];
loginToken = this.request.headers['x-login-token'];
// Get the user from the database
if... | authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken}
# Retur... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 91 | 107 |
kahmali/meteor-restivus:lib/router.coffee:5:completion | completion | authenticate = ->
# Get the auth info from header
userId = this.request.headers['x-user-id']
loginToken = this.request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken} | # Return an error if the login token does not match any belonging to the user
if not user
# TODO: Execute the http error response here
return [403, {success: false, message: "You must be logged in to do this."}]
this.user = user
Restfully = new @Restfully() | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 81843d54efadac692c7c8cdbd9888d85090ba0a6 | 541 | https://github.com/kahmali/meteor-restivus/blob/81843d54efadac692c7c8cdbd9888d85090ba0a6/lib/router.coffee | 91 | 107 |
kahmali/meteor-restivus:lib/router.coffee:2:raw_corpus | raw_corpus | @Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different paramete... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 15 | 64 | ||
kahmali/meteor-restivus:lib/router.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions wi... | this.Restfully.prototype.add = function(path, options, methods) {
var self;
self = this;
path = this.config.apiPath + path;
console.log(`Adding ${_.keys(methods)} methods to path: ${path}`);
// Throw an error if this path has already been added
// TODO: Check for collisions with paths that follow same patte... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.Restfully.prototype.add = function(path, options, methods) {
var self;
self = this;
path = this.config.apiPath + path;
console.log(`Adding ${_.keys(methods)} methods to path: ${path}`);
// Throw an error if this path has already been added
// TODO:... | @Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different paramete... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:2:completion | completion | @Restfully.prototype.add = (path, options, methods) ->
self = this
path = this.config.apiPath + path
console.log "Adding #{_.keys(methods)} methods to path: #{path}"
# Throw an error if this path has already been added
# TODO: Check for collisions with paths that follow same pattern with different paramete... | responseBody = methods.get.call(this)
else if method is 'POST' and methods.post
_.extend this.params, this.request.body
responseBody = methods.post.call(this)
else if method is 'PUT' and methods.put
_.extend this.params, this.request.body
responseBody = methods.put.call(this)... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 15 | 64 |
kahmali/meteor-restivus:lib/router.coffee:3:raw_corpus | raw_corpus | return
###
Configure the ReST API
Can only be called once.
### | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 65 | 72 | ||
kahmali/meteor-restivus:lib/router.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return
###
Configure the ReST API
Can only be called once.
###
``` | return;
/*
Configure the ReST API
Can only be called once.
*/ | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 65 | 72 |
kahmali/meteor-restivus:lib/router.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
return;
/*
Configure the ReST API
Can only be called once.
*/
``` | return
###
Configure the ReST API
Can only be called once.
### | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 65 | 72 |
kahmali/meteor-restivus:lib/router.coffee:5:raw_corpus | raw_corpus | authenticate = (request) ->
# Get the auth info from header
userId = request.headers['x-user-id']
loginToken = request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken}
# Retur... | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 93 | 107 | ||
kahmali/meteor-restivus:lib/router.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
authenticate = (request) ->
# Get the auth info from header
userId = request.headers['x-user-id']
loginToken = request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 's... | var Restfully, authenticate;
authenticate = function(request) {
var loginToken, user, userId;
// Get the auth info from header
userId = request.headers['x-user-id'];
loginToken = request.headers['x-login-token'];
// Get the user from the database
if (userId && loginToken) {
user = Meteor.users.findOne(... | CoffeeScript | JavaScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 93 | 107 |
kahmali/meteor-restivus:lib/router.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Restfully, authenticate;
authenticate = function(request) {
var loginToken, user, userId;
// Get the auth info from header
userId = request.headers['x-user-id'];
loginToken = request.headers['x-login-token'];
// Get the user from the database
if (u... | authenticate = (request) ->
# Get the auth info from header
userId = request.headers['x-user-id']
loginToken = request.headers['x-login-token']
# Get the user from the database
if userId and loginToken
user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken}
# Retur... | JavaScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 93 | 107 |
kahmali/meteor-restivus:lib/router.coffee:5:completion | completion | authenticate = (request) ->
# Get the auth info from header
userId = request.headers['x-user-id']
loginToken = request.headers['x-login-token']
# Get the user from the database
if userId and loginToken | user = Meteor.users.findOne {'_id': userId, 'services.resume.loginTokens.token': loginToken}
# Return an error if the login token does not match any belonging to the user
if not user
# TODO: Execute the http error response here
return [403, {success: false, message: "You must be logged in to do this."}]
R... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | lib/router.coffee | MIT | 2a3be8d3089a2bd3854704aed302cbe02a8c8af5 | 541 | https://github.com/kahmali/meteor-restivus/blob/2a3be8d3089a2bd3854704aed302cbe02a8c8af5/lib/router.coffee | 93 | 107 |
CaryLandholt/AngularFun:scripts/app.coffee:1:raw_corpus | raw_corpus | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angularResource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'ngResource... | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 207b1409b08f2b5e811a57584497a5c0ec09a368 | 672 | https://github.com/CaryLandholt/AngularFun/blob/207b1409b08f2b5e811a57584497a5c0ec09a368/scripts/app.coffee | 1 | 21 | ||
CaryLandholt/AngularFun:scripts/app.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angularResource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [... | /*global define*/
define(['libs/angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'libs/angularResource', 'responseInterceptors/responseInterceptors', 'services/services'], function(angular) {
'use strict';
return angular.module('app', ['controllers', 'directives', 'filters', 'ngResou... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 207b1409b08f2b5e811a57584497a5c0ec09a368 | 672 | https://github.com/CaryLandholt/AngularFun/blob/207b1409b08f2b5e811a57584497a5c0ec09a368/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['libs/angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'libs/angularResource', 'responseInterceptors/responseInterceptors', 'services/services'], function(angular) {
'use strict';
return angular.module('... | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angularResource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'ngResource... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 207b1409b08f2b5e811a57584497a5c0ec09a368 | 672 | https://github.com/CaryLandholt/AngularFun/blob/207b1409b08f2b5e811a57584497a5c0ec09a368/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:completion | completion | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angularResource'
'responseInterceptors/responseInterceptors'
'services/services' | ], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'ngResource'
'responseInterceptors'
'services'
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 207b1409b08f2b5e811a57584497a5c0ec09a368 | 672 | https://github.com/CaryLandholt/AngularFun/blob/207b1409b08f2b5e811a57584497a5c0ec09a368/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:raw_corpus | raw_corpus | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'ngResourc... | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | a0fe3a453e28b488b6b711d2110bb1eeb574c8eb | 672 | https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/app.coffee | 1 | 21 | ||
CaryLandholt/AngularFun:scripts/app.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', ... | /*global define*/
define(['libs/angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'libs/angular-resource', 'responseInterceptors/responseInterceptors', 'services/services'], function(angular) {
'use strict';
return angular.module('app', ['controllers', 'directives', 'filters', 'ngReso... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | a0fe3a453e28b488b6b711d2110bb1eeb574c8eb | 672 | https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['libs/angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'libs/angular-resource', 'responseInterceptors/responseInterceptors', 'services/services'], function(angular) {
'use strict';
return angular.module(... | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'ngResourc... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | a0fe3a453e28b488b6b711d2110bb1eeb574c8eb | 672 | https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:completion | completion | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services' | ], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'ngResource'
'responseInterceptors'
'services'
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | a0fe3a453e28b488b6b711d2110bb1eeb574c8eb | 672 | https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:raw_corpus | raw_corpus | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'ngResource'
'controllers'
'directives'
'filter... | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 0ae299ec8a05ddbfb2e26f04898245b95f7ab37c | 672 | https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/app.coffee | 1 | 21 | ||
CaryLandholt/AngularFun:scripts/app.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', ... | /*global define*/
define(['libs/angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'libs/angular-resource', 'responseInterceptors/responseInterceptors', 'services/services'], function(angular) {
'use strict';
return angular.module('app', ['ngResource', 'controllers', 'directives', 'fil... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 0ae299ec8a05ddbfb2e26f04898245b95f7ab37c | 672 | https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['libs/angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'libs/angular-resource', 'responseInterceptors/responseInterceptors', 'services/services'], function(angular) {
'use strict';
return angular.module(... | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'ngResource'
'controllers'
'directives'
'filter... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 0ae299ec8a05ddbfb2e26f04898245b95f7ab37c | 672 | https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:completion | completion | ###global define###
define [
'libs/angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'libs/angular-resource'
'responseInterceptors/responseInterceptors'
'services/services' | ], (angular) ->
'use strict'
angular.module 'app', [
'ngResource'
'controllers'
'directives'
'filters'
'responseInterceptors'
'services'
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | 0ae299ec8a05ddbfb2e26f04898245b95f7ab37c | 672 | https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/app.coffee | 1 | 21 |
CaryLandholt/AngularFun:scripts/app.coffee:1:raw_corpus | raw_corpus | ###global define###
define [
'angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'services'
] | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/app.coffee | 1 | 17 | ||
CaryLandholt/AngularFun:scripts/app.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define [
'angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'services'
]
``` | /*global define*/
define(['angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'services/services'], function(angular) {
'use strict';
return angular.module('app', ['controllers', 'directives', 'filters', 'services']);
}); | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/app.coffee | 1 | 17 |
CaryLandholt/AngularFun:scripts/app.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['angular', 'controllers/controllers', 'directives/directives', 'filters/filters', 'services/services'], function(angular) {
'use strict';
return angular.module('app', ['controllers', 'directives', 'filters', 'services']);
});
``` | ###global define###
define [
'angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'services/services'
], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'services'
] | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/app.coffee | 1 | 17 |
CaryLandholt/AngularFun:scripts/app.coffee:1:completion | completion | ###global define###
define [
'angular'
'controllers/controllers'
'directives/directives'
'filters/filters'
'services/services' | ], (angular) ->
'use strict'
angular.module 'app', [
'controllers'
'directives'
'filters'
'services'
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | scripts/app.coffee | MIT | d1cdd10b75a390445a1180aeef6460f89f7bfedb | 672 | https://github.com/CaryLandholt/AngularFun/blob/d1cdd10b75a390445a1180aeef6460f89f7bfedb/scripts/app.coffee | 1 | 17 |
jianliaoim/talk-os:talk-web/test/spec/actions/notify.spec.coffee:1:raw_corpus | raw_corpus | xdescribe 'Actions: notify', ->
beforeEach ->
@action = require 'actions/notify'
@dispatcher = require 'dispatcher'
spyOn @dispatcher, 'handleViewAction'
describe 'Method: warn, error, info, success', ->
it 'should create notificiation', ->
text = 'test'
['warn', 'error', 'info', 'succ... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/notify.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/notify.spec.coffee | 1 | 43 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/notify.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
xdescribe 'Actions: notify', ->
beforeEach ->
@action = require 'actions/notify'
@dispatcher = require 'dispatcher'
spyOn @dispatcher, 'handleViewAction'
describe 'Method: warn, error, info, success', ->
it 'should create notificiation', ->
... | xdescribe('Actions: notify', function() {
beforeEach(function() {
this.action = require('actions/notify');
this.dispatcher = require('dispatcher');
return spyOn(this.dispatcher, 'handleViewAction');
});
describe('Method: warn, error, info, success', function() {
it('should create notificiation', f... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/actions/notify.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/notify.spec.coffee | 1 | 43 |
jianliaoim/talk-os:talk-web/test/spec/actions/notify.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
xdescribe('Actions: notify', function() {
beforeEach(function() {
this.action = require('actions/notify');
this.dispatcher = require('dispatcher');
return spyOn(this.dispatcher, 'handleViewAction');
});
describe('Method: warn, error, info, success... | xdescribe 'Actions: notify', ->
beforeEach ->
@action = require 'actions/notify'
@dispatcher = require 'dispatcher'
spyOn @dispatcher, 'handleViewAction'
describe 'Method: warn, error, info, success', ->
it 'should create notificiation', ->
text = 'test'
['warn', 'error', 'info', 'succ... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/notify.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/notify.spec.coffee | 1 | 43 |
jianliaoim/talk-os:talk-web/test/spec/actions/notify.spec.coffee:1:completion | completion | xdescribe 'Actions: notify', ->
beforeEach ->
@action = require 'actions/notify'
@dispatcher = require 'dispatcher'
spyOn @dispatcher, 'handleViewAction'
describe 'Method: warn, error, info, success', ->
it 'should create notificiation', ->
text = 'test'
['warn', 'error', 'info', 'succ... | text = 'test'
config =
isSticky: true
['warn', 'error', 'info', 'success'].forEach (method) =>
@action[method](text, config)
dispatchData =
type: 'notify/create'
data:
type: method
text: text
config: config
expect(@dispa... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/notify.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/notify.spec.coffee | 1 | 43 |
jianliaoim/talk-os:talk-web/client/updater/user.coffee:1:raw_corpus | raw_corpus | exports.me = (store, userData) ->
if userData?
store
.set 'user', userData
.set 'prefs', userData.get('preference')
else
store.set 'user', null
# user object: http://talk.ci/doc/restful/user.update.html
exports.update = (store, contactData) ->
_contactId = contactData.get('_id')
store
.upda... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/user.coffee | 1 | 32 | ||
jianliaoim/talk-os:talk-web/client/updater/user.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.me = (store, userData) ->
if userData?
store
.set 'user', userData
.set 'prefs', userData.get('preference')
else
store.set 'user', null
# user object: http://talk.ci/doc/restful/user.update.html
exports.update = (store, contactData) ... | exports.me = function(store, userData) {
if (userData != null) {
return store.set('user', userData).set('prefs', userData.get('preference'));
} else {
return store.set('user', null);
}
};
// user object: http://talk.ci/doc/restful/user.update.html
exports.update = function(store, contactData) {
var _co... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/user.coffee | 1 | 32 |
jianliaoim/talk-os:talk-web/client/updater/user.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.me = function(store, userData) {
if (userData != null) {
return store.set('user', userData).set('prefs', userData.get('preference'));
} else {
return store.set('user', null);
}
};
// user object: http://talk.ci/doc/restful/user.update.html
ex... | exports.me = (store, userData) ->
if userData?
store
.set 'user', userData
.set 'prefs', userData.get('preference')
else
store.set 'user', null
# user object: http://talk.ci/doc/restful/user.update.html
exports.update = (store, contactData) ->
_contactId = contactData.get('_id')
store
.upda... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/user.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/user.coffee | 1 | 32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.