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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorContext, ColorScanner, registry;
ColorScanner = require('../lib/color-scanner');
ColorContext = require('../lib/color-context');
registry = require('../lib/color-expressions');
describe('ColorScanner', function() {
var editor, lastIndex, result, scan... | ColorScanner = require '../lib/color-scanner'
ColorContext = require '../lib/color-context'
registry = require '../lib/color-expressions'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
... | JavaScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 734b870e50dfdc3f946a1264889bca8bd2fdc528 | 518 | https://github.com/abe33/atom-pigments/blob/734b870e50dfdc3f946a1264889bca8bd2fdc528/spec/color-scanner-spec.coffee | 1 | 40 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:completion | completion | ColorScanner = require '../lib/color-scanner'
ColorContext = require '../lib/color-context'
registry = require '../lib/color-expressions'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
... | withTextEditor fixture, ->
beforeEach ->
context = new ColorContext({registry})
scanner = new ColorScanner({context})
afterEach -> scanner = null
do block
describe '::search', ->
withScannerForTextEditor 'html-entities.html', ->
beforeEach ->
result = scanner.sea... | CoffeeScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 734b870e50dfdc3f946a1264889bca8bd2fdc528 | 518 | https://github.com/abe33/atom-pigments/blob/734b870e50dfdc3f946a1264889bca8bd2fdc528/spec/color-scanner-spec.coffee | 1 | 40 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:raw_corpus | raw_corpus | it 'returns nothing', ->
expect(result).toBeUndefined()
withScannerForTextEditor 'four-variables.styl', ->
beforeEach ->
result = scanner.search(text)
it 'returns the first buffer color match', ->
expect(result).toBeDefined()
describe 'the resulting buffer color', ->
... | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 734b870e50dfdc3f946a1264889bca8bd2fdc528 | 518 | https://github.com/abe33/atom-pigments/blob/734b870e50dfdc3f946a1264889bca8bd2fdc528/spec/color-scanner-spec.coffee | 42 | 82 | ||
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'returns nothing', ->
expect(result).toBeUndefined()
withScannerForTextEditor 'four-variables.styl', ->
beforeEach ->
result = scanner.search(text)
it 'returns the first buffer color match', ->
expect(result).toBeDefin... | it('returns nothing', function() {
return expect(result).toBeUndefined();
});
withScannerForTextEditor('four-variables.styl', function() {
beforeEach(function() {
var result;
return result = scanner.search(text);
});
it('returns the first buffer color match', function() {
return expect(result).toBe... | CoffeeScript | JavaScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 734b870e50dfdc3f946a1264889bca8bd2fdc528 | 518 | https://github.com/abe33/atom-pigments/blob/734b870e50dfdc3f946a1264889bca8bd2fdc528/spec/color-scanner-spec.coffee | 42 | 82 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('returns nothing', function() {
return expect(result).toBeUndefined();
});
withScannerForTextEditor('four-variables.styl', function() {
beforeEach(function() {
var result;
return result = scanner.search(text);
});
it('returns the first buffer co... | it 'returns nothing', ->
expect(result).toBeUndefined()
withScannerForTextEditor 'four-variables.styl', ->
beforeEach ->
result = scanner.search(text)
it 'returns the first buffer color match', ->
expect(result).toBeDefined()
describe 'the resulting buffer color', ->
... | JavaScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 734b870e50dfdc3f946a1264889bca8bd2fdc528 | 518 | https://github.com/abe33/atom-pigments/blob/734b870e50dfdc3f946a1264889bca8bd2fdc528/spec/color-scanner-spec.coffee | 42 | 82 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:completion | completion | it 'returns nothing', ->
expect(result).toBeUndefined()
withScannerForTextEditor 'four-variables.styl', ->
beforeEach ->
result = scanner.search(text)
it 'returns the first buffer color match', ->
expect(result).toBeDefined()
describe 'the resulting buffer color', ->
... | it 'stores the last index', ->
expect(result.lastIndex).toEqual(17)
it 'stores match line', ->
expect(result.line).toEqual(0)
describe 'successive searches', ->
it 'returns a buffer color for each match and then undefined', ->
doSearch = -> result = scanner.search(t... | CoffeeScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 734b870e50dfdc3f946a1264889bca8bd2fdc528 | 518 | https://github.com/abe33/atom-pigments/blob/734b870e50dfdc3f946a1264889bca8bd2fdc528/spec/color-scanner-spec.coffee | 42 | 82 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:raw_corpus | raw_corpus | ColorScanner = require '../lib/color-scanner'
ColorContext = require '../lib/color-context'
{TextEditor} = require 'atom'
registry = require '../lib/color-expressions'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buf... | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/spec/color-scanner-spec.coffee | 1 | 41 | ||
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ColorScanner = require '../lib/color-scanner'
ColorContext = require '../lib/color-context'
{TextEditor} = require 'atom'
registry = require '../lib/color-expressions'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEdito... | var ColorContext, ColorScanner, TextEditor, registry;
ColorScanner = require('../lib/color-scanner');
ColorContext = require('../lib/color-context');
({TextEditor} = require('atom'));
registry = require('../lib/color-expressions');
describe('ColorScanner', function() {
var editor, lastIndex, result, scanner, tex... | CoffeeScript | JavaScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/spec/color-scanner-spec.coffee | 1 | 41 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorContext, ColorScanner, TextEditor, registry;
ColorScanner = require('../lib/color-scanner');
ColorContext = require('../lib/color-context');
({TextEditor} = require('atom'));
registry = require('../lib/color-expressions');
describe('ColorScanner', fun... | ColorScanner = require '../lib/color-scanner'
ColorContext = require '../lib/color-context'
{TextEditor} = require 'atom'
registry = require '../lib/color-expressions'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buf... | JavaScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/spec/color-scanner-spec.coffee | 1 | 41 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:completion | completion | ColorScanner = require '../lib/color-scanner'
ColorContext = require '../lib/color-context'
{TextEditor} = require 'atom'
registry = require '../lib/color-expressions'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buf... | withScannerForTextEditor = (fixture, block) ->
withTextEditor fixture, ->
beforeEach ->
context = new ColorContext({registry})
scanner = new ColorScanner({context})
afterEach -> scanner = null
do block
describe '::search', ->
withScannerForTextEditor 'html-entities.html', ... | CoffeeScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 85cec032e06bb0e06b45873652cd0627c90189d7 | 518 | https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/spec/color-scanner-spec.coffee | 1 | 41 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:raw_corpus | raw_corpus | ColorScanner = require '../lib/color-scanner'
{TextEditor} = require 'atom'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
waitsForPromise -> atom.workspace.open(fixture)
... | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 1 | 50 | ||
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ColorScanner = require '../lib/color-scanner'
{TextEditor} = require 'atom'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
... | var ColorScanner, TextEditor;
ColorScanner = require('../lib/color-scanner');
({TextEditor} = require('atom'));
describe('ColorScanner', function() {
var editor, lastIndex, result, scanner, text, withScannerForTextEditor, withTextEditor;
[scanner, editor, text, result, lastIndex] = [];
withTextEditor = functio... | CoffeeScript | JavaScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 1 | 50 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ColorScanner, TextEditor;
ColorScanner = require('../lib/color-scanner');
({TextEditor} = require('atom'));
describe('ColorScanner', function() {
var editor, lastIndex, result, scanner, text, withScannerForTextEditor, withTextEditor;
[scanner, editor, te... | ColorScanner = require '../lib/color-scanner'
{TextEditor} = require 'atom'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
waitsForPromise -> atom.workspace.open(fixture)
... | JavaScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 1 | 50 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:1:completion | completion | ColorScanner = require '../lib/color-scanner'
{TextEditor} = require 'atom'
describe 'ColorScanner', ->
[scanner, editor, text, result, lastIndex] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
waitsForPromise -> atom.workspace.open(fixture)
... | do block
describe '::search', ->
withScannerForTextEditor 'html-entities.html', ->
beforeEach ->
result = scanner.search(text)
it 'returns nothing', ->
expect(result).toBeUndefined()
withScannerForTextEditor 'css-color-with-prefix.less', ->
beforeEach ->
result = s... | CoffeeScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 1 | 50 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:raw_corpus | raw_corpus | it 'has a text range', ->
expect(result.range).toEqual([13,17])
it 'has a color', ->
expect(result.color).toBeColor('#ffffff')
it 'stores the matched text', ->
expect(result.match).toEqual('#fff')
it 'stores the last index', ->
expect(result.lastIndex).... | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 51 | 80 | ||
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'has a text range', ->
expect(result.range).toEqual([13,17])
it 'has a color', ->
expect(result.color).toBeColor('#ffffff')
it 'stores the matched text', ->
expect(result.match).toEqual('#fff')
it 'store... | it('has a text range', function() {
return expect(result.range).toEqual([13, 17]);
});
it('has a color', function() {
return expect(result.color).toBeColor('#ffffff');
});
it('stores the matched text', function() {
return expect(result.match).toEqual('#fff');
});
it('stores the last index', function() {
retu... | CoffeeScript | JavaScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 51 | 80 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('has a text range', function() {
return expect(result.range).toEqual([13, 17]);
});
it('has a color', function() {
return expect(result.color).toBeColor('#ffffff');
});
it('stores the matched text', function() {
return expect(result.match).toEqual('#fff'... | it 'has a text range', ->
expect(result.range).toEqual([13,17])
it 'has a color', ->
expect(result.color).toBeColor('#ffffff')
it 'stores the matched text', ->
expect(result.match).toEqual('#fff')
it 'stores the last index', ->
expect(result.lastIndex).... | JavaScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 51 | 80 |
abe33/atom-pigments:spec/color-scanner-spec.coffee:2:completion | completion | it 'has a text range', ->
expect(result.range).toEqual([13,17])
it 'has a color', ->
expect(result.color).toBeColor('#ffffff')
it 'stores the matched text', ->
expect(result.match).toEqual('#fff')
it 'stores the last index', ->
expect(result.lastIndex).... | describe 'successive searches', ->
it 'returns a buffer color for each match and then undefined', ->
doSearch = -> result = scanner.search(text, result.lastIndex)
expect(doSearch()).toBeDefined()
expect(doSearch()).toBeDefined()
expect(doSearch()).toBeDefined()
... | CoffeeScript | CoffeeScript | abe33/atom-pigments | spec/color-scanner-spec.coffee | MIT | 6b9b5368e8a617bbb73ccdb1da96350aba9fd444 | 518 | https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/spec/color-scanner-spec.coffee | 51 | 80 |
jianliaoim/talk-os:talk-web/client/module/markdown.coffee:1:raw_corpus | raw_corpus | cx = require 'classnames'
React = require 'react'
MarkdownIt = require 'markdown-it'
MarkdownItEmoji = require 'markdown-it-emoji/light'
MarkdownItAttrs = require 'markdown-it-attrs'
PureRenderMixin = require 'react-addons-pure-render-mixin'
emojiUtil = require '../util/emoji'
emojisList = require('../util/emojis-list... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/markdown.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/markdown.coffee | 1 | 46 | ||
jianliaoim/talk-os:talk-web/client/module/markdown.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
cx = require 'classnames'
React = require 'react'
MarkdownIt = require 'markdown-it'
MarkdownItEmoji = require 'markdown-it-emoji/light'
MarkdownItAttrs = require 'markdown-it-attrs'
PureRenderMixin = require 'react-addons-pure-render-mixin'
emojiUtil = require ... | var MarkdownIt, MarkdownItAttrs, MarkdownItEmoji, PureRenderMixin, React, T, cx, div, emojiUtil, emojisList, markdown;
cx = require('classnames');
React = require('react');
MarkdownIt = require('markdown-it');
MarkdownItEmoji = require('markdown-it-emoji/light');
MarkdownItAttrs = require('markdown-it-attrs');
Pu... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/markdown.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/markdown.coffee | 1 | 46 |
jianliaoim/talk-os:talk-web/client/module/markdown.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MarkdownIt, MarkdownItAttrs, MarkdownItEmoji, PureRenderMixin, React, T, cx, div, emojiUtil, emojisList, markdown;
cx = require('classnames');
React = require('react');
MarkdownIt = require('markdown-it');
MarkdownItEmoji = require('markdown-it-emoji/light'... | cx = require 'classnames'
React = require 'react'
MarkdownIt = require 'markdown-it'
MarkdownItEmoji = require 'markdown-it-emoji/light'
MarkdownItAttrs = require 'markdown-it-attrs'
PureRenderMixin = require 'react-addons-pure-render-mixin'
emojiUtil = require '../util/emoji'
emojisList = require('../util/emojis-list... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/markdown.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/markdown.coffee | 1 | 46 |
jianliaoim/talk-os:talk-web/client/module/markdown.coffee:1:completion | completion | cx = require 'classnames'
React = require 'react'
MarkdownIt = require 'markdown-it'
MarkdownItEmoji = require 'markdown-it-emoji/light'
MarkdownItAttrs = require 'markdown-it-attrs'
PureRenderMixin = require 'react-addons-pure-render-mixin'
emojiUtil = require '../util/emoji'
emojisList = require('../util/emojis-list... | shortcuts: {}
.use MarkdownItAttrs
.disable 'image'
markdown.renderer.rules.emoji = (token, idx) ->
emojiUtil.toElement token[idx].markup
module.exports = React.createClass
displayName: 'markdown'
mixins: [PureRenderMixin]
propTypes:
value: T.string
getDefaultProps: ->
value: ''
render: ->... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/markdown.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/markdown.coffee | 1 | 46 |
jianliaoim/talk-os:talk-api2x/test/jobs/save-call-usage.coffee:1:raw_corpus | raw_corpus | should = require 'should'
Promise = require 'bluebird'
limbo = require 'limbo'
app = require '../app'
util = require '../../server/util'
{prepare, cleanup} = app
{
UsageModel
UsageHistoryModel
} = limbo.use 'talk'
saveCallUsageJob = require '../../server/jobs/save-call-usage'
describe 'Job#SaveCallUsage', ->
... | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/jobs/save-call-usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/jobs/save-call-usage.coffee | 1 | 49 | ||
jianliaoim/talk-os:talk-api2x/test/jobs/save-call-usage.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
should = require 'should'
Promise = require 'bluebird'
limbo = require 'limbo'
app = require '../app'
util = require '../../server/util'
{prepare, cleanup} = app
{
UsageModel
UsageHistoryModel
} = limbo.use 'talk'
saveCallUsageJob = require '../../server/... | var Promise, UsageHistoryModel, UsageModel, app, cleanup, limbo, prepare, saveCallUsageJob, should, util;
should = require('should');
Promise = require('bluebird');
limbo = require('limbo');
app = require('../app');
util = require('../../server/util');
({prepare, cleanup} = app);
({UsageModel, UsageHistoryModel}... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/test/jobs/save-call-usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/jobs/save-call-usage.coffee | 1 | 49 |
jianliaoim/talk-os:talk-api2x/test/jobs/save-call-usage.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Promise, UsageHistoryModel, UsageModel, app, cleanup, limbo, prepare, saveCallUsageJob, should, util;
should = require('should');
Promise = require('bluebird');
limbo = require('limbo');
app = require('../app');
util = require('../../server/util');
({prep... | should = require 'should'
Promise = require 'bluebird'
limbo = require 'limbo'
app = require '../app'
util = require '../../server/util'
{prepare, cleanup} = app
{
UsageModel
UsageHistoryModel
} = limbo.use 'talk'
saveCallUsageJob = require '../../server/jobs/save-call-usage'
describe 'Job#SaveCallUsage', ->
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/jobs/save-call-usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/jobs/save-call-usage.coffee | 1 | 49 |
jianliaoim/talk-os:talk-api2x/test/jobs/save-call-usage.coffee:1:completion | completion | should = require 'should'
Promise = require 'bluebird'
limbo = require 'limbo'
app = require '../app'
util = require '../../server/util'
{prepare, cleanup} = app
{
UsageModel
UsageHistoryModel
} = limbo.use 'talk'
saveCallUsageJob = require '../../server/jobs/save-call-usage'
describe 'Job#SaveCallUsage', ->
... | ]
$checkUsage = $saveCallUsage.then ->
UsageModel.findOneAsync
type: 'call'
team: app.team1._id
month: util.getCurrentMonth()
.then (usage) ->
usage.amount.should.eql 25
$checkUsageHistory = $saveCallUsage.then ->
UsageHistoryModel.findAsync
type: 'call'
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/test/jobs/save-call-usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/test/jobs/save-call-usage.coffee | 1 | 49 |
jashkenas/coffeescript:src/browser.coffee:1:raw_corpus | raw_corpus | CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
globalRoot = if window? then window else global
globalRoot['eval'] compile code, options
# Running code does not provide access to this scope. | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 13 | 18 | ||
jashkenas/coffeescript:src/browser.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
globalRoot = if window? then window else global
globalRoot['eval'] compile code, options
# Running code does not provide access to this scope.
``` | CoffeeScript.eval = function(code, options = {}) {
var globalRoot;
if (options.bare == null) {
options.bare = true;
}
globalRoot = typeof window !== "undefined" && window !== null ? window : global;
return globalRoot['eval'](compile(code, options));
};
// Running code does not provide access to this scop... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 13 | 18 |
jashkenas/coffeescript:src/browser.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
CoffeeScript.eval = function(code, options = {}) {
var globalRoot;
if (options.bare == null) {
options.bare = true;
}
globalRoot = typeof window !== "undefined" && window !== null ? window : global;
return globalRoot['eval'](compile(code, options));
}... | CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
globalRoot = if window? then window else global
globalRoot['eval'] compile code, options
# Running code does not provide access to this scope. | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 13 | 18 |
jashkenas/coffeescript:src/browser.coffee:1:completion | completion | CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
globalRoot = if window? then window else global | globalRoot['eval'] compile code, options
# Running code does not provide access to this scope. | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 13 | 18 |
jashkenas/coffeescript:src/browser.coffee:2:raw_corpus | raw_corpus | CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on
Function(compile code, options)()
# Export this more limited `CoffeeScript` than what is exported by
# `index.coffee`, which is intended for a Node environment. | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 19 | 25 | ||
jashkenas/coffeescript:src/browser.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on
Function(compile code, options)()
# Export this more limited `CoffeeScript` than what is exported by
# `index.coffee`, which is intended for a Node environment.
``` | CoffeeScript.run = function(code, options = {}) {
options.bare = true;
options.shiftLine = true;
return Function(compile(code, options))();
};
// Export this more limited `CoffeeScript` than what is exported by
// `index.coffee`, which is intended for a Node environment. | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 19 | 25 |
jashkenas/coffeescript:src/browser.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
CoffeeScript.run = function(code, options = {}) {
options.bare = true;
options.shiftLine = true;
return Function(compile(code, options))();
};
// Export this more limited `CoffeeScript` than what is exported by
// `index.coffee`, which is intended for a Node... | CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on
Function(compile code, options)()
# Export this more limited `CoffeeScript` than what is exported by
# `index.coffee`, which is intended for a Node environment. | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 19 | 25 |
jashkenas/coffeescript:src/browser.coffee:2:completion | completion | CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on | Function(compile code, options)()
# Export this more limited `CoffeeScript` than what is exported by
# `index.coffee`, which is intended for a Node environment. | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 19 | 25 |
jashkenas/coffeescript:src/browser.coffee:3:raw_corpus | raw_corpus | module.exports = CoffeeScript
# If we’re not in a browser environment, we’re finished with the public API.
return unless window?
# Include source maps where possible. If we’ve got a base64 encoder, a
# JSON serializer, and tools for escaping unicode characters, we’re good to go.
# Ported from https://developer.mozill... | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 26 | 39 | ||
jashkenas/coffeescript:src/browser.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = CoffeeScript
# If we’re not in a browser environment, we’re finished with the public API.
return unless window?
# Include source maps where possible. If we’ve got a base64 encoder, a
# JSON serializer, and tools for escaping unicode characters,... | var compile;
module.exports = CoffeeScript;
// If we’re not in a browser environment, we’re finished with the public API.
if (typeof window === "undefined" || window === null) {
return;
}
// Include source maps where possible. If we’ve got a base64 encoder, a
// JSON serializer, and tools for escaping unicode char... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 26 | 39 |
jashkenas/coffeescript:src/browser.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var compile;
module.exports = CoffeeScript;
// If we’re not in a browser environment, we’re finished with the public API.
if (typeof window === "undefined" || window === null) {
return;
}
// Include source maps where possible. If we’ve got a base64 encoder, a
... | module.exports = CoffeeScript
# If we’re not in a browser environment, we’re finished with the public API.
return unless window?
# Include source maps where possible. If we’ve got a base64 encoder, a
# JSON serializer, and tools for escaping unicode characters, we’re good to go.
# Ported from https://developer.mozill... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 26 | 39 |
jashkenas/coffeescript:src/browser.coffee:3:completion | completion | module.exports = CoffeeScript
# If we’re not in a browser environment, we’re finished with the public API.
return unless window?
# Include source maps where possible. If we’ve got a base64 encoder, a
# JSON serializer, and tools for escaping unicode characters, we’re good to go. | # Ported from https://developer.mozilla.org/en-US/docs/DOM/window.btoa
if btoa? and JSON?
compile = (code, options = {}) ->
options.inlineMap = true
CoffeeScript.compile code, options
# Load a remote script from the current domain via XHR. | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 26 | 39 |
jashkenas/coffeescript:src/browser.coffee:4:raw_corpus | raw_corpus | CoffeeScript.load = (url, callback, options = {}, hold = false) ->
options.sourceFiles = [url]
xhr = if window.ActiveXObject
new window.ActiveXObject('Microsoft.XMLHTTP')
else
new window.XMLHttpRequest()
xhr.open 'GET', url, true
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
xhr.onr... | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 40 | 60 | ||
jashkenas/coffeescript:src/browser.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
CoffeeScript.load = (url, callback, options = {}, hold = false) ->
options.sourceFiles = [url]
xhr = if window.ActiveXObject
new window.ActiveXObject('Microsoft.XMLHTTP')
else
new window.XMLHttpRequest()
xhr.open 'GET', url, true
xhr.overrideMim... | CoffeeScript.load = function(url, callback, options = {}, hold = false) {
var xhr;
options.sourceFiles = [url];
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest();
xhr.open('GET', url, true);
if ('overrideMimeType' in xhr) {
xhr.overrideMimeType('text/... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 40 | 60 |
jashkenas/coffeescript:src/browser.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
CoffeeScript.load = function(url, callback, options = {}, hold = false) {
var xhr;
options.sourceFiles = [url];
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest();
xhr.open('GET', url, true);
if ('over... | CoffeeScript.load = (url, callback, options = {}, hold = false) ->
options.sourceFiles = [url]
xhr = if window.ActiveXObject
new window.ActiveXObject('Microsoft.XMLHTTP')
else
new window.XMLHttpRequest()
xhr.open 'GET', url, true
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
xhr.onr... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 40 | 60 |
jashkenas/coffeescript:src/browser.coffee:4:completion | completion | CoffeeScript.load = (url, callback, options = {}, hold = false) ->
options.sourceFiles = [url]
xhr = if window.ActiveXObject
new window.ActiveXObject('Microsoft.XMLHTTP')
else
new window.XMLHttpRequest()
xhr.open 'GET', url, true
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
xhr.onr... | if xhr.status in [0, 200]
param = [xhr.responseText, options]
CoffeeScript.run param... unless hold
else
throw new Error "Could not load #{url}"
callback param if callback
xhr.send null
# Activate CoffeeScript in the browser by having it compile and evaluate
# all script tags with... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 40 | 60 |
jashkenas/coffeescript:src/browser.coffee:5:raw_corpus | raw_corpus | CoffeeScript.runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.r... | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 61 | 107 | ||
jashkenas/coffeescript:src/browser.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
CoffeeScript.runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[... | var indexOf = [].indexOf;
CoffeeScript.runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() {
var j, len, ref, res... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 61 | 107 |
jashkenas/coffeescript:src/browser.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
CoffeeScript.runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescrip... | CoffeeScript.runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.r... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 61 | 107 |
jashkenas/coffeescript:src/browser.coffee:5:completion | completion | CoffeeScript.runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.r... | options
true
else
# `options.filename` defines the filename the source map appears as
# in Developer Tools. If a script tag has an `id`, use that as the
# filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
# leaving the first one unnumbered for the common ca... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 817c39a13065a900725943c33a79252a69d779e2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/browser.coffee | 61 | 107 |
jashkenas/coffeescript:src/browser.coffee:5:raw_corpus | raw_corpus | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | d82272b6c28ed3606d87df1963e6636151140a51 | 16,577 | https://github.com/jashkenas/coffeescript/blob/d82272b6c28ed3606d87df1963e6636151140a51/src/browser.coffee | 61 | 102 | ||
jashkenas/coffeescript:src/browser.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if... | var runScripts,
indexOf = [].indexOf;
runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() {
var j, len, ref, re... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | d82272b6c28ed3606d87df1963e6636151140a51 | 16,577 | https://github.com/jashkenas/coffeescript/blob/d82272b6c28ed3606d87df1963e6636151140a51/src/browser.coffee | 61 | 102 |
jashkenas/coffeescript:src/browser.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var runScripts,
indexOf = [].indexOf;
runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescri... | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | d82272b6c28ed3606d87df1963e6636151140a51 | 16,577 | https://github.com/jashkenas/coffeescript/blob/d82272b6c28ed3606d87df1963e6636151140a51/src/browser.coffee | 61 | 102 |
jashkenas/coffeescript:src/browser.coffee:5:completion | completion | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | coffees[i] = param
execute()
options
true
else
# `options.filename` defines the filename the source map appears as
# in Developer Tools. If a script tag has an `id`, use that as the
# filename; otherwise use `coffeescript`, or `coffeescript1` etc.,
#... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | d82272b6c28ed3606d87df1963e6636151140a51 | 16,577 | https://github.com/jashkenas/coffeescript/blob/d82272b6c28ed3606d87df1963e6636151140a51/src/browser.coffee | 61 | 102 |
jashkenas/coffeescript:src/browser.coffee:1:raw_corpus | raw_corpus | CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
eval compile code, options
# Running code does not provide access to this scope. | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 8407dd885a2de4b9b061177f67e41f3df84f53b2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/browser.coffee | 10 | 14 | ||
jashkenas/coffeescript:src/browser.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
eval compile code, options
# Running code does not provide access to this scope.
``` | CoffeeScript.eval = function(code, options = {}) {
if (options.bare == null) {
options.bare = true;
}
return eval(compile(code, options));
};
// Running code does not provide access to this scope. | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 8407dd885a2de4b9b061177f67e41f3df84f53b2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/browser.coffee | 10 | 14 |
jashkenas/coffeescript:src/browser.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
CoffeeScript.eval = function(code, options = {}) {
if (options.bare == null) {
options.bare = true;
}
return eval(compile(code, options));
};
// Running code does not provide access to this scope.
``` | CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on
eval compile code, options
# Running code does not provide access to this scope. | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 8407dd885a2de4b9b061177f67e41f3df84f53b2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/browser.coffee | 10 | 14 |
jashkenas/coffeescript:src/browser.coffee:1:completion | completion | CoffeeScript.eval = (code, options = {}) ->
options.bare ?= on | eval compile code, options
# Running code does not provide access to this scope. | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 8407dd885a2de4b9b061177f67e41f3df84f53b2 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8407dd885a2de4b9b061177f67e41f3df84f53b2/src/browser.coffee | 10 | 14 |
jashkenas/coffeescript:src/browser.coffee:2:raw_corpus | raw_corpus | CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on
Function(compile code, options)()
# If we're not in a browser environment, we're finished with the public API.
return unless window?
# Include source maps where possible. If we've got a base64 encoder, a
# JSON serializer, ... | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201 | 16,577 | https://github.com/jashkenas/coffeescript/blob/a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201/src/browser.coffee | 16 | 32 | ||
jashkenas/coffeescript:src/browser.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on
Function(compile code, options)()
# If we're not in a browser environment, we're finished with the public API.
return unless window?
# Include source maps where possi... | var compile;
CoffeeScript.run = function(code, options = {}) {
options.bare = true;
options.shiftLine = true;
return Function(compile(code, options))();
};
// If we're not in a browser environment, we're finished with the public API.
if (typeof window === "undefined" || window === null) {
return;
}
// Includ... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201 | 16,577 | https://github.com/jashkenas/coffeescript/blob/a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201/src/browser.coffee | 16 | 32 |
jashkenas/coffeescript:src/browser.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var compile;
CoffeeScript.run = function(code, options = {}) {
options.bare = true;
options.shiftLine = true;
return Function(compile(code, options))();
};
// If we're not in a browser environment, we're finished with the public API.
if (typeof window === "... | CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on
Function(compile code, options)()
# If we're not in a browser environment, we're finished with the public API.
return unless window?
# Include source maps where possible. If we've got a base64 encoder, a
# JSON serializer, ... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201 | 16,577 | https://github.com/jashkenas/coffeescript/blob/a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201/src/browser.coffee | 16 | 32 |
jashkenas/coffeescript:src/browser.coffee:2:completion | completion | CoffeeScript.run = (code, options = {}) ->
options.bare = on
options.shiftLine = on
Function(compile code, options)()
# If we're not in a browser environment, we're finished with the public API.
return unless window? | # Include source maps where possible. If we've got a base64 encoder, a
# JSON serializer, and tools for escaping unicode characters, we're good to go.
# Ported from https://developer.mozilla.org/en-US/docs/DOM/window.btoa
if btoa? and JSON?
compile = (code, options = {}) ->
options.inlineMap = true
CoffeeScri... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201 | 16,577 | https://github.com/jashkenas/coffeescript/blob/a5cb8cd7c34abb5ee3ed3507e9466894ebdbc201/src/browser.coffee | 16 | 32 |
jashkenas/coffeescript:src/browser.coffee:4:raw_corpus | raw_corpus | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd | 16,577 | https://github.com/jashkenas/coffeescript/blob/7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd/src/browser.coffee | 54 | 95 | ||
jashkenas/coffeescript:src/browser.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if... | var runScripts,
indexOf = [].indexOf;
runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() {
var j, len, ref, re... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd | 16,577 | https://github.com/jashkenas/coffeescript/blob/7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd/src/browser.coffee | 54 | 95 |
jashkenas/coffeescript:src/browser.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var runScripts,
indexOf = [].indexOf;
runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescri... | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd | 16,577 | https://github.com/jashkenas/coffeescript/blob/7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd/src/browser.coffee | 54 | 95 |
jashkenas/coffeescript:src/browser.coffee:4:completion | completion | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | coffees[i] = param
execute()
options
true
else
# `options.filename` defines how the filename the source map appears as
# in Developer Tools. If a script tag has an `id`, use that as the
# filename; otherwise use `coffeescript`, or `coffeescript1` etc.
... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd | 16,577 | https://github.com/jashkenas/coffeescript/blob/7de06c3dcba319cace960ddd5bcaa2ebf0e95bfd/src/browser.coffee | 54 | 95 |
jashkenas/coffeescript:src/browser.coffee:4:raw_corpus | raw_corpus | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/src/browser.coffee | 54 | 88 | ||
jashkenas/coffeescript:src/browser.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if... | var runScripts,
indexOf = [].indexOf;
runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];
coffees = (function() {
var j, len, ref, re... | CoffeeScript | JavaScript | jashkenas/coffeescript | src/browser.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/src/browser.coffee | 54 | 88 |
jashkenas/coffeescript:src/browser.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var runScripts,
indexOf = [].indexOf;
runScripts = function() {
var coffees, coffeetypes, execute, i, index, j, len, s, script, scripts;
scripts = window.document.getElementsByTagName('script');
coffeetypes = ['text/coffeescript', 'text/literate-coffeescri... | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | JavaScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/src/browser.coffee | 54 | 88 |
jashkenas/coffeescript:src/browser.coffee:4:completion | completion | runScripts = ->
scripts = window.document.getElementsByTagName 'script'
coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']
coffees = (s for s in scripts when s.type in coffeetypes)
index = 0
execute = ->
param = coffees[index]
if param instanceof Array
CoffeeScript.run param...
... | if source
CoffeeScript.load source,
(param) ->
coffees[i] = param
execute()
options
true
else
options.sourceFiles = ['embedded']
coffees[i] = [script.innerHTML, options]
execute()
# Listen for window load, both in decent browsers an... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | src/browser.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/src/browser.coffee | 54 | 88 |
jnordberg/wintersmith:lib/cli/build.coffee:1:raw_corpus | raw_corpus | async = require 'async'
{app} = require 'flatiron'
rimraf = require 'rimraf'
fs = require 'fs'
colors = require 'colors'
{logger} = require '../common' # lib common
{getOptions, commonOptions} = require './common' # cli common
wintersmith = require '../'
usage = """
usage: wintersmith build [options]
options:
... | CoffeeScript | jnordberg/wintersmith | lib/cli/build.coffee | MIT | f01b0c9862c0cb38dbd62af492e2955581fd974e | 3,484 | https://github.com/jnordberg/wintersmith/blob/f01b0c9862c0cb38dbd62af492e2955581fd974e/lib/cli/build.coffee | 1 | 50 | ||
jnordberg/wintersmith:lib/cli/build.coffee:1:completion | completion | async = require 'async'
{app} = require 'flatiron'
rimraf = require 'rimraf'
fs = require 'fs'
colors = require 'colors'
{logger} = require '../common' # lib common
{getOptions, commonOptions} = require './common' # cli common
wintersmith = require '../'
usage = """
usage: wintersmith build [options]
options:
... | $ wintersmith build
build using command line options:
$ wintersmith build -o /var/www/public/ -T extra_data.json -C ~/my-blog
or using both (command-line options will override config options):
$ wintersmith build --config another_config.json --rebuild
"""
build = ->
start = new Date()
logger.info... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | lib/cli/build.coffee | MIT | f01b0c9862c0cb38dbd62af492e2955581fd974e | 3,484 | https://github.com/jnordberg/wintersmith/blob/f01b0c9862c0cb38dbd62af492e2955581fd974e/lib/cli/build.coffee | 1 | 50 |
jnordberg/wintersmith:lib/cli/build.coffee:2:raw_corpus | raw_corpus | else
callback()
(callback) ->
# start building
wintersmith options, callback
], callback
], (error) ->
if error
logger.error error.message, error
else
stop = new Date()
delta = stop - start
logger.info "done in #{ delta.toString().bold } ms... | CoffeeScript | jnordberg/wintersmith | lib/cli/build.coffee | MIT | f01b0c9862c0cb38dbd62af492e2955581fd974e | 3,484 | https://github.com/jnordberg/wintersmith/blob/f01b0c9862c0cb38dbd62af492e2955581fd974e/lib/cli/build.coffee | 51 | 67 | ||
jnordberg/wintersmith:lib/cli/build.coffee:2:completion | completion | else
callback()
(callback) ->
# start building
wintersmith options, callback
], callback
], (error) ->
if error | logger.error error.message, error
else
stop = new Date()
delta = stop - start
logger.info "done in #{ delta.toString().bold } ms\n"
module.exports = build
module.exports.usage = usage
module.exports.name = 'build' | CoffeeScript | CoffeeScript | jnordberg/wintersmith | lib/cli/build.coffee | MIT | f01b0c9862c0cb38dbd62af492e2955581fd974e | 3,484 | https://github.com/jnordberg/wintersmith/blob/f01b0c9862c0cb38dbd62af492e2955581fd974e/lib/cli/build.coffee | 51 | 67 |
xhan/qqbot:src/qqplugin.coffee:1:raw_corpus | raw_corpus | EventEmitter = require('events').EventEmitter
class QQPlugin extends EventEmitter
constructor: (@plugins,@listen) ->
@listeners = []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (content ,send, robot, message)->
for plugin in @li... | CoffeeScript | xhan/qqbot | src/qqplugin.coffee | MIT | 42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c | 1,435 | https://github.com/xhan/qqbot/blob/42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c/src/qqplugin.coffee | 1 | 14 | ||
xhan/qqbot:src/qqplugin.coffee:1:completion | completion | EventEmitter = require('events').EventEmitter
class QQPlugin extends EventEmitter
constructor: (@plugins,@listen) ->
@listeners = []
for plugin_name in @plugins
@listeners.push require "../plugins/#{plugin_name}" | dispatch: (content ,send, robot, message)->
for plugin in @listeners
plugin(content ,send, robot, message)
module.exports = QQPlugin | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqplugin.coffee | MIT | 42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c | 1,435 | https://github.com/xhan/qqbot/blob/42842fe6d7fbeafd53e9bacde8cb5a079cdddb0c/src/qqplugin.coffee | 1 | 14 |
xhan/qqbot:src/qqplugin.coffee:1:raw_corpus | raw_corpus | EventEmitter = require('events').EventEmitter
class QQPlugin extends EventEmitter
constructor: (@plugins,@listen) ->
@listeners = []
for i, plugin_name of @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (content ,send, robot, message)->
for i, plugin ... | CoffeeScript | xhan/qqbot | src/qqplugin.coffee | MIT | e020f31262ee986548ebc3060d2481d10cfa038b | 1,435 | https://github.com/xhan/qqbot/blob/e020f31262ee986548ebc3060d2481d10cfa038b/src/qqplugin.coffee | 1 | 15 | ||
xhan/qqbot:src/qqplugin.coffee:1:completion | completion | EventEmitter = require('events').EventEmitter
class QQPlugin extends EventEmitter
constructor: (@plugins,@listen) ->
@listeners = []
for i, plugin_name of @plugins
@listeners.push require "../plugins/#{plugin_name}" | dispatch: (content ,send, robot, message)->
for i, plugin of @listeners
plugin(content ,send, robot, message)
module.exports = QQPlugin | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqplugin.coffee | MIT | e020f31262ee986548ebc3060d2481d10cfa038b | 1,435 | https://github.com/xhan/qqbot/blob/e020f31262ee986548ebc3060d2481d10cfa038b/src/qqplugin.coffee | 1 | 15 |
xhan/qqbot:src/qqplugin.coffee:1:raw_corpus | raw_corpus | EventEmitter = require('events').EventEmitter
class QQPlugin extends EventEmitter
constructor: (@plugins,@listen) ->
@listeners = []
for i, plugin_name of @plugins
@listeners.push require "../plugins/#{plugin_name}"
dispatch: (robot,message)->
for i, plugin of @listeners
... | CoffeeScript | xhan/qqbot | src/qqplugin.coffee | MIT | b92c72e0ce4ad69d45e6b071af6e2de4e97d6b6d | 1,435 | https://github.com/xhan/qqbot/blob/b92c72e0ce4ad69d45e6b071af6e2de4e97d6b6d/src/qqplugin.coffee | 1 | 13 | ||
xhan/qqbot:src/qqplugin.coffee:1:completion | completion | EventEmitter = require('events').EventEmitter
class QQPlugin extends EventEmitter
constructor: (@plugins,@listen) ->
@listeners = []
for i, plugin_name of @plugins | @listeners.push require "../plugins/#{plugin_name}"
dispatch: (robot,message)->
for i, plugin of @listeners
plugin( robot , message)
module.exports = QQPlugin | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqplugin.coffee | MIT | b92c72e0ce4ad69d45e6b071af6e2de4e97d6b6d | 1,435 | https://github.com/xhan/qqbot/blob/b92c72e0ce4ad69d45e6b071af6e2de4e97d6b6d/src/qqplugin.coffee | 1 | 13 |
octoblu/meshblu:lib/authDevice.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device'
device = new Device {uuid: uuid}, {config: dependencies.config}
d... | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 611d835b53ab2c3719d728738eb18dd071e111ea | 815 | https://github.com/octoblu/meshblu/blob/611d835b53ab2c3719d728738eb18dd071e111ea/lib/authDevice.coffee | 1 | 16 | ||
octoblu/meshblu:lib/authDevice.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device'
device = n... | var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var Device, device, ref;
Device = (ref = dependencies.Device) != null... | CoffeeScript | JavaScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 611d835b53ab2c3719d728738eb18dd071e111ea | 815 | https://github.com/octoblu/meshblu/blob/611d835b53ab2c3719d728738eb18dd071e111ea/lib/authDevice.coffee | 1 | 16 |
octoblu/meshblu:lib/authDevice.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var Device, devi... | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device'
device = new Device {uuid: uuid}, {config: dependencies.config}
d... | JavaScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 611d835b53ab2c3719d728738eb18dd071e111ea | 815 | https://github.com/octoblu/meshblu/blob/611d835b53ab2c3719d728738eb18dd071e111ea/lib/authDevice.coffee | 1 | 16 |
octoblu/meshblu:lib/authDevice.coffee:1:completion | completion | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device'
device = new Device {uuid: uuid}, {config: dependencies.config} | device.verifyToken token, (error, verified) =>
debug('verifyToken', error.stack) if error?
return callback error if error?
return callback new Error('Unable to find valid device') unless verified
device.fetch (error, attributes) =>
debug('fetch', error.stack) if error?
return callback error ... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 611d835b53ab2c3719d728738eb18dd071e111ea | 815 | https://github.com/octoblu/meshblu/blob/611d835b53ab2c3719d728738eb18dd071e111ea/lib/authDevice.coffee | 1 | 16 |
octoblu/meshblu:lib/authDevice.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device'
device = new Device {uuid: uuid}, {config: dependencies.config}
d... | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 9b9df23482cb10e7ec062d4a91d0def3afacd1b9 | 815 | https://github.com/octoblu/meshblu/blob/9b9df23482cb10e7ec062d4a91d0def3afacd1b9/lib/authDevice.coffee | 1 | 14 | ||
octoblu/meshblu:lib/authDevice.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device'
device = n... | var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var Device, device, ref;
Device = (ref = dependencies.Device) != null... | CoffeeScript | JavaScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 9b9df23482cb10e7ec062d4a91d0def3afacd1b9 | 815 | https://github.com/octoblu/meshblu/blob/9b9df23482cb10e7ec062d4a91d0def3afacd1b9/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var Device, devi... | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device'
device = new Device {uuid: uuid}, {config: dependencies.config}
d... | JavaScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 9b9df23482cb10e7ec062d4a91d0def3afacd1b9 | 815 | https://github.com/octoblu/meshblu/blob/9b9df23482cb10e7ec062d4a91d0def3afacd1b9/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:completion | completion | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
Device = dependencies.Device ? require './models/device' | device = new Device {uuid: uuid}, {config: dependencies.config}
device.verifyToken token, (error, verified) =>
return callback error if error?
return callback new Error('Unable to find valid device') unless verified
device.fetch (error, attributes) =>
return callback error if error?
callback n... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 9b9df23482cb10e7ec062d4a91d0def3afacd1b9 | 815 | https://github.com/octoblu/meshblu/blob/9b9df23482cb10e7ec062d4a91d0def3afacd1b9/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device'
device = new @Device uuid: uuid
device.verifyToken token, (error... | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/authDevice.coffee | 1 | 14 | ||
octoblu/meshblu:lib/authDevice.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device'
device = ... | var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var device, ref;
this.Device = (ref = dependencies.Device) != null ? ... | CoffeeScript | JavaScript | octoblu/meshblu | lib/authDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var device, ref;... | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device'
device = new @Device uuid: uuid
device.verifyToken token, (error... | JavaScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:completion | completion | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device' | device = new @Device uuid: uuid
device.verifyToken token, (error, verified) =>
return callback error if error?
return callback new Error('Unable to find valid device') unless verified
device.fetch (error, attributes) =>
return callback error if error?
callback null, attributes | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | cb391c74d09b0a15a42c95b0dc884034632400d8 | 815 | https://github.com/octoblu/meshblu/blob/cb391c74d09b0a15a42c95b0dc884034632400d8/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device'
device = new @Device uuid: uuid
device.verifyToken token, (error... | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 83684923f1be1a39418dc1a331416def34eebf83 | 815 | https://github.com/octoblu/meshblu/blob/83684923f1be1a39418dc1a331416def34eebf83/lib/authDevice.coffee | 1 | 14 | ||
octoblu/meshblu:lib/authDevice.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device'
device = ... | var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var device, ref;
this.Device = (ref = dependencies.Device) != null ? ... | CoffeeScript | JavaScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 83684923f1be1a39418dc1a331416def34eebf83 | 815 | https://github.com/octoblu/meshblu/blob/83684923f1be1a39418dc1a331416def34eebf83/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _, async, bcrypt, debug;
_ = require('lodash');
async = require('async');
bcrypt = require('bcrypt');
debug = require('debug')('meshblu:authDevice');
module.exports = function(uuid, token, callback = (function() {}), dependencies = {}) {
var device, ref;... | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device'
device = new @Device uuid: uuid
device.verifyToken token, (error... | JavaScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 83684923f1be1a39418dc1a331416def34eebf83 | 815 | https://github.com/octoblu/meshblu/blob/83684923f1be1a39418dc1a331416def34eebf83/lib/authDevice.coffee | 1 | 14 |
octoblu/meshblu:lib/authDevice.coffee:1:completion | completion | _ = require 'lodash'
async = require 'async'
bcrypt = require 'bcrypt'
debug = require('debug')('meshblu:authDevice')
module.exports = (uuid, token, callback=(->), dependencies={}) ->
@Device = dependencies.Device ? require './models/device' | device = new @Device uuid: uuid
device.verifyToken token, (error, verified) =>
return callback error if error?
return callback new Error('Unable to find valid device') unless verified?
device.fetch (error, attributes) =>
return callback error if error?
callback null, attributes | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/authDevice.coffee | MIT | 83684923f1be1a39418dc1a331416def34eebf83 | 815 | https://github.com/octoblu/meshblu/blob/83684923f1be1a39418dc1a331416def34eebf83/lib/authDevice.coffee | 1 | 14 |
buttercoin/buttercoin:test/test_journal.coffee:1:raw_corpus | raw_corpus | chai = require 'chai'
chai.should()
expect = chai.expect
assert = chai.assert
Q = require('q')
fs = require 'fs'
Journal = require '../lib/journal'
Ops = require '../lib/operations'
TestHelper = require('./test_helper')
logger = require('../lib/logger')
kTestFilename = 'test.log'
describe 'Journal', ->
beforeEach... | CoffeeScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 1 | 50 | ||
buttercoin/buttercoin:test/test_journal.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
chai = require 'chai'
chai.should()
expect = chai.expect
assert = chai.assert
Q = require('q')
fs = require 'fs'
Journal = require '../lib/journal'
Ops = require '../lib/operations'
TestHelper = require('./test_helper')
logger = require('../lib/logger')
kTestF... | var Journal, Ops, Q, TestHelper, assert, chai, expect, fs, kTestFilename, logger;
chai = require('chai');
chai.should();
expect = chai.expect;
assert = chai.assert;
Q = require('q');
fs = require('fs');
Journal = require('../lib/journal');
Ops = require('../lib/operations');
TestHelper = require('./test_helper... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 1 | 50 |
buttercoin/buttercoin:test/test_journal.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Journal, Ops, Q, TestHelper, assert, chai, expect, fs, kTestFilename, logger;
chai = require('chai');
chai.should();
expect = chai.expect;
assert = chai.assert;
Q = require('q');
fs = require('fs');
Journal = require('../lib/journal');
Ops = require('..... | chai = require 'chai'
chai.should()
expect = chai.expect
assert = chai.assert
Q = require('q')
fs = require 'fs'
Journal = require '../lib/journal'
Ops = require '../lib/operations'
TestHelper = require('./test_helper')
logger = require('../lib/logger')
kTestFilename = 'test.log'
describe 'Journal', ->
beforeEach... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 1 | 50 |
buttercoin/buttercoin:test/test_journal.coffee:1:completion | completion | chai = require 'chai'
chai.should()
expect = chai.expect
assert = chai.assert
Q = require('q')
fs = require 'fs'
Journal = require '../lib/journal'
Ops = require '../lib/operations'
TestHelper = require('./test_helper')
logger = require('../lib/logger')
kTestFilename = 'test.log'
describe 'Journal', ->
beforeEach... | console.log 'EXECUTE OP', op
).then =>
console.log 'FINISHED'
assert journal.filename is kTestFilename
journal.shutdown().then =>
finish()
.done()
it 'should initialize if the log file already exists', (finish) ->
logger.info('test journal')
journal = new Journal( kTestFilen... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 1 | 50 |
buttercoin/buttercoin:test/test_journal.coffee:2:raw_corpus | raw_corpus | it 'should record a message correctly', (finish) ->
journal = new Journal( kTestFilename )
journal.start((op) =>
console.log 'EXECUTE OP', op
).then =>
raw_msg = [ Ops.ADD_DEPOSIT, "fake" ]
msg = JSON.stringify(raw_msg)
journal.record msg
.then =>
journal.flush()
jour... | CoffeeScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 51 | 65 | ||
buttercoin/buttercoin:test/test_journal.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should record a message correctly', (finish) ->
journal = new Journal( kTestFilename )
journal.start((op) =>
console.log 'EXECUTE OP', op
).then =>
raw_msg = [ Ops.ADD_DEPOSIT, "fake" ]
msg = JSON.stringify(raw_msg)
journal... | it('should record a message correctly', function(finish) {
var journal;
journal = new Journal(kTestFilename);
return journal.start((op) => {
return console.log('EXECUTE OP', op);
}).then(() => {
var msg, raw_msg;
raw_msg = [Ops.ADD_DEPOSIT, "fake"];
msg = JSON.stringify(raw_msg);
return jour... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 51 | 65 |
buttercoin/buttercoin:test/test_journal.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should record a message correctly', function(finish) {
var journal;
journal = new Journal(kTestFilename);
return journal.start((op) => {
return console.log('EXECUTE OP', op);
}).then(() => {
var msg, raw_msg;
raw_msg = [Ops.ADD_DEPOSIT, "fak... | it 'should record a message correctly', (finish) ->
journal = new Journal( kTestFilename )
journal.start((op) =>
console.log 'EXECUTE OP', op
).then =>
raw_msg = [ Ops.ADD_DEPOSIT, "fake" ]
msg = JSON.stringify(raw_msg)
journal.record msg
.then =>
journal.flush()
jour... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 51 | 65 |
buttercoin/buttercoin:test/test_journal.coffee:2:completion | completion | it 'should record a message correctly', (finish) ->
journal = new Journal( kTestFilename )
journal.start((op) =>
console.log 'EXECUTE OP', op
).then =>
raw_msg = [ Ops.ADD_DEPOSIT, "fake" ]
msg = JSON.stringify(raw_msg) | journal.record msg
.then =>
journal.flush()
journal.shutdown().then =>
assert fs.existsSync kTestFilename
finish()
.done() | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_journal.coffee | MIT | ccba3845df6afdfde2bc4da0f3abb62494473ddc | 663 | https://github.com/buttercoin/buttercoin/blob/ccba3845df6afdfde2bc4da0f3abb62494473ddc/test/test_journal.coffee | 51 | 65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.