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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jashkenas/coffeescript:documentation/v1/code.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs = require 'fs'
CoffeeScript = require '../../lib/coffeescript'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "d... | var CoffeeScript, fs;
fs = require('fs');
CoffeeScript = require('../../lib/coffeescript');
module.exports = function() {
var counter, hljs;
counter = 0;
hljs = require('highlight.js');
hljs.configure({
classPrefix: ''
});
return function(file, executable = false, showLoad = true) {
var append, b... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v1/code.coffee | 1 | 25 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var CoffeeScript, fs;
fs = require('fs');
CoffeeScript = require('../../lib/coffeescript');
module.exports = function() {
var counter, hljs;
counter = 0;
hljs = require('highlight.js');
hljs.configure({
classPrefix: ''
});
return function(file, e... | fs = require 'fs'
CoffeeScript = require '../../lib/coffeescript'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = C... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v1/code.coffee | 1 | 25 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:completion | completion | fs = require 'fs'
CoffeeScript = require '../../lib/coffeescript'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = C... | js = js.replace /^\/\/ generated.*?\n/i, ''
cshtml = "<pre><code>#{hljs.highlight('coffeescript', cs).value}</code></pre>"
jshtml = "<pre><code>#{hljs.highlight('javascript', js).value}</code></pre>"
append = if executable is yes then '' else "alert(#{executable});".replace /"/g, '"'
if executable... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v1/code.coffee | 1 | 25 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = ... | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | e620434a2e1f913153a93656aab869453a536cd4 | 16,577 | https://github.com/jashkenas/coffeescript/blob/e620434a2e1f913153a93656aab869453a536cd4/documentation/v1/code.coffee | 1 | 25 | ||
jashkenas/coffeescript:documentation/v1/code.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "... | var CoffeeScript, fs;
fs = require('fs');
CoffeeScript = require('../../lib/coffee-script');
module.exports = function() {
var counter, hljs;
counter = 0;
hljs = require('highlight.js');
hljs.configure({
classPrefix: ''
});
return function(file, executable = false, showLoad = true) {
var append, ... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | e620434a2e1f913153a93656aab869453a536cd4 | 16,577 | https://github.com/jashkenas/coffeescript/blob/e620434a2e1f913153a93656aab869453a536cd4/documentation/v1/code.coffee | 1 | 25 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var CoffeeScript, fs;
fs = require('fs');
CoffeeScript = require('../../lib/coffee-script');
module.exports = function() {
var counter, hljs;
counter = 0;
hljs = require('highlight.js');
hljs.configure({
classPrefix: ''
});
return function(file, ... | fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = ... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | e620434a2e1f913153a93656aab869453a536cd4 | 16,577 | https://github.com/jashkenas/coffeescript/blob/e620434a2e1f913153a93656aab869453a536cd4/documentation/v1/code.coffee | 1 | 25 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:completion | completion | fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = ... | js = js.replace /^\/\/ generated.*?\n/i, ''
cshtml = "<pre><code>#{hljs.highlight('coffeescript', cs).value}</code></pre>"
jshtml = "<pre><code>#{hljs.highlight('javascript', js).value}</code></pre>"
append = if executable is yes then '' else "alert(#{executable});".replace /"/g, '"'
if executable... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | e620434a2e1f913153a93656aab869453a536cd4 | 16,577 | https://github.com/jashkenas/coffeescript/blob/e620434a2e1f913153a93656aab869453a536cd4/documentation/v1/code.coffee | 1 | 25 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = ... | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 85b3be9ce383a44baab97699c8d3e1727a65801c | 16,577 | https://github.com/jashkenas/coffeescript/blob/85b3be9ce383a44baab97699c8d3e1727a65801c/documentation/v1/code.coffee | 1 | 29 | ||
jashkenas/coffeescript:documentation/v1/code.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "... | var CoffeeScript, fs;
fs = require('fs');
CoffeeScript = require('../../lib/coffee-script');
module.exports = function() {
var counter, hljs;
counter = 0;
hljs = require('highlight.js');
hljs.configure({
classPrefix: ''
});
return function(file, executable = false, showLoad = true) {
var append, ... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 85b3be9ce383a44baab97699c8d3e1727a65801c | 16,577 | https://github.com/jashkenas/coffeescript/blob/85b3be9ce383a44baab97699c8d3e1727a65801c/documentation/v1/code.coffee | 1 | 29 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var CoffeeScript, fs;
fs = require('fs');
CoffeeScript = require('../../lib/coffee-script');
module.exports = function() {
var counter, hljs;
counter = 0;
hljs = require('highlight.js');
hljs.configure({
classPrefix: ''
});
return function(file, ... | fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = ... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 85b3be9ce383a44baab97699c8d3e1727a65801c | 16,577 | https://github.com/jashkenas/coffeescript/blob/85b3be9ce383a44baab97699c8d3e1727a65801c/documentation/v1/code.coffee | 1 | 29 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:completion | completion | fs = require 'fs'
CoffeeScript = require '../../lib/coffee-script'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = ... | cshtml = "<pre><code>#{hljs.highlight('coffeescript', cs).value}</code></pre>"
# Temporary fix until highlight.js adds support for newer CoffeeScript keywords
# Added in https://github.com/isagalaev/highlight.js/pull/1357, awaiting release
if file in ['generator_iteration', 'generators', 'modules']
cs... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 85b3be9ce383a44baab97699c8d3e1727a65801c | 16,577 | https://github.com/jashkenas/coffeescript/blob/85b3be9ce383a44baab97699c8d3e1727a65801c/documentation/v1/code.coffee | 1 | 29 |
gandm/language-babel:lib/main.coffee:1:raw_corpus | raw_corpus | module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './tr... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 13 | 62 | ||
gandm/language-babel:lib/main.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponen... | module.exports = {
activate: function(state) {
var observeStatusBarGrammarNameTimer;
// run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(this.observeStatusBarGrammarName.bind(this), 1000);
autoCompleteStyledCompo... | CoffeeScript | JavaScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 13 | 62 |
gandm/language-babel:lib/main.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
activate: function(state) {
var observeStatusBarGrammarNameTimer;
// run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(this.observeStatusBarGra... | module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './tr... | JavaScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 13 | 62 |
gandm/language-babel:lib/main.coffee:1:completion | completion | module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './tr... | @textEditors[textEditor.id]?.autoIndent?.destroy()
delete @textEditors[textEditor.id]?.autoIndent?
@textEditors[textEditor.id].add textEditor.onDidSave (event) =>
if textEditor.getGrammar().packageName is LB
filePath = textEditor.getPath()
lastSaveTime = @fileSaveTimes[fileP... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 13 | 62 |
gandm/language-babel:lib/main.coffee:2:raw_corpus | raw_corpus | disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
@mutateStatusGrammarNameObserver?.disconnet()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 63 | 112 | ||
gandm/language-babel:lib/main.coffee:2:completion | completion | disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
@mutateStatusGrammarNameObserver?.disconnet()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'... | atom.notifications.addInfo 'Incompatible Package Detected',
dismissable: true
detail: "language-babel has detected the presence of an
incompatible Atom package named '#{activatedPackage.name}'.
\n \nIt is recommended that you disable either '#{activatedPackage.nam... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 63 | 112 |
gandm/language-babel:lib/main.coffee:3:raw_corpus | raw_corpus | clearInterval(observeStatusBarGrammarNameTimer)
observeStatusBarGrammarNameTimerCalled = 0
# only expect a single child (grammar name) for this DOM Node
if target.length is 1
target = target[0].childNodes?[0]
if target
# don't run again as we are now observing
clearInterval(o... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 113 | 141 | ||
gandm/language-babel:lib/main.coffee:3:completion | completion | clearInterval(observeStatusBarGrammarNameTimer)
observeStatusBarGrammarNameTimerCalled = 0
# only expect a single child (grammar name) for this DOM Node
if target.length is 1
target = target[0].childNodes?[0]
if target
# don't run again as we are now observing
clearInterval(o... | mutateStatusGrammarNameObserver = new MutationObserver (mutations) =>
mutations.forEach (mutation) =>
@mutateStatusBarGrammarName(mutation.target)
# configuration of the observer:
config = { attributes: true, childList: false, characterData: false }
# pass in the targe... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | d7d260522eb0f6528ea8558beb1bda54c5d25eba | 474 | https://github.com/gandm/language-babel/blob/d7d260522eb0f6528ea8558beb1bda54c5d25eba/lib/main.coffee | 113 | 141 |
gandm/language-babel:lib/main.coffee:1:raw_corpus | raw_corpus | module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './tr... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 7b06041e5174a004f7361c384cbcc8f7eed94428 | 474 | https://github.com/gandm/language-babel/blob/7b06041e5174a004f7361c384cbcc8f7eed94428/lib/main.coffee | 13 | 62 | ||
gandm/language-babel:lib/main.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponen... | module.exports = {
activate: function(state) {
var observeStatusBarGrammarNameTimer;
// run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(this.observeStatusBarGrammarName.bind(this), 1000);
autoCompleteStyledCompo... | CoffeeScript | JavaScript | gandm/language-babel | lib/main.coffee | MIT | 7b06041e5174a004f7361c384cbcc8f7eed94428 | 474 | https://github.com/gandm/language-babel/blob/7b06041e5174a004f7361c384cbcc8f7eed94428/lib/main.coffee | 13 | 62 |
gandm/language-babel:lib/main.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
activate: function(state) {
var observeStatusBarGrammarNameTimer;
// run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(this.observeStatusBarGra... | module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './tr... | JavaScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 7b06041e5174a004f7361c384cbcc8f7eed94428 | 474 | https://github.com/gandm/language-babel/blob/7b06041e5174a004f7361c384cbcc8f7eed94428/lib/main.coffee | 13 | 62 |
gandm/language-babel:lib/main.coffee:1:completion | completion | module.exports =
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './tr... | @textEditors[textEditor.id]?.autoIndent?.destroy()
delete @textEditors[textEditor.id]?.autoIndent?
@textEditors[textEditor.id].add textEditor.onDidSave (event) =>
if textEditor.getGrammar().packageName is LB
filePath = textEditor.getPath()
lastSaveTime = @fileSaveTimes[fileP... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 7b06041e5174a004f7361c384cbcc8f7eed94428 | 474 | https://github.com/gandm/language-babel/blob/7b06041e5174a004f7361c384cbcc8f7eed94428/lib/main.coffee | 13 | 62 |
gandm/language-babel:lib/main.coffee:2:raw_corpus | raw_corpus | disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
@mutateStatusGrammarNameObserver?.disconnet()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 6323471d7493a6c1ca83c0d12ca39af6c2040a4a | 474 | https://github.com/gandm/language-babel/blob/6323471d7493a6c1ca83c0d12ca39af6c2040a4a/lib/main.coffee | 62 | 111 | ||
gandm/language-babel:lib/main.coffee:2:completion | completion | disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
@mutateStatusGrammarNameObserver?.disconnet()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'... | atom.notifications.addInfo 'Incompatible Package Detected',
dismissable: true
detail: "language-babel has detected the presence of an
incompatible Atom package named '#{activatedPackage.name}'.
\n \nIt is recommended that you disable either '#{activatedPackage.nam... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 6323471d7493a6c1ca83c0d12ca39af6c2040a4a | 474 | https://github.com/gandm/language-babel/blob/6323471d7493a6c1ca83c0d12ca39af6c2040a4a/lib/main.coffee | 62 | 111 |
gandm/language-babel:lib/main.coffee:1:raw_corpus | raw_corpus | module.exports =
config: require './config'
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@tr... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 4c625edfe3268a3f18fc8e8bb093a8c9a5527a54 | 474 | https://github.com/gandm/language-babel/blob/4c625edfe3268a3f18fc8e8bb093a8c9a5527a54/lib/main.coffee | 12 | 61 | ||
gandm/language-babel:lib/main.coffee:1:completion | completion | module.exports =
config: require './config'
activate: (state) ->
# run observeStatusBarGrammarName until Atom has created the Status Bar Grammar Name DOM node
observeStatusBarGrammarNameTimer = setInterval(@observeStatusBarGrammarName.bind(@), 1000)
autoCompleteStyledComponents.loadProperties()
@tr... | @textEditors[textEditor.id].autoIndent = new AutoIndent(textEditor)
else
@textEditors[textEditor.id]?.autoIndent?.destroy()
delete @textEditors[textEditor.id]?.autoIndent?
@textEditors[textEditor.id].add textEditor.onDidSave (event) =>
if textEditor.getGrammar().packageName is... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 4c625edfe3268a3f18fc8e8bb093a8c9a5527a54 | 474 | https://github.com/gandm/language-babel/blob/4c625edfe3268a3f18fc8e8bb093a8c9a5527a54/lib/main.coffee | 12 | 61 |
gandm/language-babel:lib/main.coffee:2:raw_corpus | raw_corpus | @textEditors[id].autoIndent.destroy()
delete @textEditors[id].autoIndent
disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
@mutateStatusGrammarNameObserver?.disconnet()
# warns if an activated package is on the incompatible... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 4c625edfe3268a3f18fc8e8bb093a8c9a5527a54 | 474 | https://github.com/gandm/language-babel/blob/4c625edfe3268a3f18fc8e8bb093a8c9a5527a54/lib/main.coffee | 62 | 111 | ||
gandm/language-babel:lib/main.coffee:2:completion | completion | @textEditors[id].autoIndent.destroy()
delete @textEditors[id].autoIndent
disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
@mutateStatusGrammarNameObserver?.disconnet()
# warns if an activated package is on the incompatible... | for incompatiblePackage, reason of incompatiblePackages
if activatedPackage.name is incompatiblePackage
atom.notifications.addInfo 'Incompatible Package Detected',
dismissable: true
detail: "language-babel has detected the presence of an
incompatible Atom package name... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 4c625edfe3268a3f18fc8e8bb093a8c9a5527a54 | 474 | https://github.com/gandm/language-babel/blob/4c625edfe3268a3f18fc8e8bb093a8c9a5527a54/lib/main.coffee | 62 | 111 |
gandm/language-babel:lib/main.coffee:3:raw_corpus | raw_corpus | # only run this for so many cycles without getting a valid dom node
if ++observeStatusBarGrammarNameTimerCalled > 60
clearInterval(observeStatusBarGrammarNameTimer)
observeStatusBarGrammarNameTimerCalled = 0
# only expect a single child (grammar name) for this DOM Node
if target.length is 1
... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 4c625edfe3268a3f18fc8e8bb093a8c9a5527a54 | 474 | https://github.com/gandm/language-babel/blob/4c625edfe3268a3f18fc8e8bb093a8c9a5527a54/lib/main.coffee | 112 | 142 | ||
gandm/language-babel:lib/main.coffee:3:completion | completion | # only run this for so many cycles without getting a valid dom node
if ++observeStatusBarGrammarNameTimerCalled > 60
clearInterval(observeStatusBarGrammarNameTimer)
observeStatusBarGrammarNameTimerCalled = 0
# only expect a single child (grammar name) for this DOM Node
if target.length is 1
... | # create an observer instance
mutateStatusGrammarNameObserver = new MutationObserver (mutations) =>
mutations.forEach (mutation) =>
@mutateStatusBarGrammarName(mutation.target)
# configuration of the observer:
config = { attributes: true, childList: false, characterData... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 4c625edfe3268a3f18fc8e8bb093a8c9a5527a54 | 474 | https://github.com/gandm/language-babel/blob/4c625edfe3268a3f18fc8e8bb093a8c9a5527a54/lib/main.coffee | 112 | 142 |
gandm/language-babel:lib/main.coffee:1:raw_corpus | raw_corpus | module.exports =
config: require './config'
activate: (state) ->
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@textEditor... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 27da84437eabceb1e33469091177805141d9d69f | 474 | https://github.com/gandm/language-babel/blob/27da84437eabceb1e33469091177805141d9d69f/lib/main.coffee | 10 | 59 | ||
gandm/language-babel:lib/main.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
config: require './config'
activate: (state) ->
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
... | module.exports = {
config: require('./config'),
activate: function(state) {
autoCompleteStyledComponents.loadProperties();
if (this.transpiler == null) {
this.transpiler = new (require('./transpiler'))();
}
this.ttlGrammar = new ttlGrammar(true);
// track any file save events and transpile... | CoffeeScript | JavaScript | gandm/language-babel | lib/main.coffee | MIT | 27da84437eabceb1e33469091177805141d9d69f | 474 | https://github.com/gandm/language-babel/blob/27da84437eabceb1e33469091177805141d9d69f/lib/main.coffee | 10 | 59 |
gandm/language-babel:lib/main.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
config: require('./config'),
activate: function(state) {
autoCompleteStyledComponents.loadProperties();
if (this.transpiler == null) {
this.transpiler = new (require('./transpiler'))();
}
this.ttlGrammar = new ttlGrammar... | module.exports =
config: require './config'
activate: (state) ->
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@textEditor... | JavaScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 27da84437eabceb1e33469091177805141d9d69f | 474 | https://github.com/gandm/language-babel/blob/27da84437eabceb1e33469091177805141d9d69f/lib/main.coffee | 10 | 59 |
gandm/language-babel:lib/main.coffee:1:completion | completion | module.exports =
config: require './config'
activate: (state) ->
autoCompleteStyledComponents.loadProperties()
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@textEditor... | @textEditors[textEditor.id]?.autoIndent?.destroy()
delete @textEditors[textEditor.id]?.autoIndent?
@textEditors[textEditor.id].add textEditor.onDidSave (event) =>
if textEditor.getGrammar().packageName is LB
filePath = textEditor.getPath()
lastSaveTime = @fileSaveTimes[fileP... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 27da84437eabceb1e33469091177805141d9d69f | 474 | https://github.com/gandm/language-babel/blob/27da84437eabceb1e33469091177805141d9d69f/lib/main.coffee | 10 | 59 |
gandm/language-babel:lib/main.coffee:2:raw_corpus | raw_corpus | disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'source-preview-babel':
"Both vie to previe... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 27da84437eabceb1e33469091177805141d9d69f | 474 | https://github.com/gandm/language-babel/blob/27da84437eabceb1e33469091177805141d9d69f/lib/main.coffee | 60 | 97 | ||
gandm/language-babel:lib/main.coffee:2:completion | completion | disposeable.dispose()
@transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'source-preview-babel':
"Both vie to previe... | \nstandard atom API's, this creates a potential conflict."
}
for incompatiblePackage, reason of incompatiblePackages
if activatedPackage.name is incompatiblePackage
atom.notifications.addInfo 'Incompatible Package Detected',
dismissable: true
detail: "language-babel has detect... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 27da84437eabceb1e33469091177805141d9d69f | 474 | https://github.com/gandm/language-babel/blob/27da84437eabceb1e33469091177805141d9d69f/lib/main.coffee | 60 | 97 |
gandm/language-babel:lib/main.coffee:1:raw_corpus | raw_corpus | module.exports =
config: require './config'
activate: (state) ->
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@textEditors = {}
@fileSaveTimes = {}
@disposable.ad... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 2a687553b7f81e5b904b3b0c778236076428634b | 474 | https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/main.coffee | 9 | 58 | ||
gandm/language-babel:lib/main.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
config: require './config'
activate: (state) ->
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@tex... | module.exports = {
config: require('./config'),
activate: function(state) {
if (this.transpiler == null) {
this.transpiler = new (require('./transpiler'))();
}
this.ttlGrammar = new ttlGrammar(true);
// track any file save events and transpile if babel
this.disposable = new CompositeDispos... | CoffeeScript | JavaScript | gandm/language-babel | lib/main.coffee | MIT | 2a687553b7f81e5b904b3b0c778236076428634b | 474 | https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/main.coffee | 9 | 58 |
gandm/language-babel:lib/main.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
config: require('./config'),
activate: function(state) {
if (this.transpiler == null) {
this.transpiler = new (require('./transpiler'))();
}
this.ttlGrammar = new ttlGrammar(true);
// track any file save events and trans... | module.exports =
config: require './config'
activate: (state) ->
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@textEditors = {}
@fileSaveTimes = {}
@disposable.ad... | JavaScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 2a687553b7f81e5b904b3b0c778236076428634b | 474 | https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/main.coffee | 9 | 58 |
gandm/language-babel:lib/main.coffee:1:completion | completion | module.exports =
config: require './config'
activate: (state) ->
@transpiler ?= new (require './transpiler')
@ttlGrammar = new ttlGrammar(true)
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@textEditors = {}
@fileSaveTimes = {}
@disposable.ad... | delete @textEditors[textEditor.id]?.autoIndent?
@textEditors[textEditor.id].add textEditor.onDidSave (event) =>
if textEditor.getGrammar().packageName is LB
filePath = textEditor.getPath()
lastSaveTime = @fileSaveTimes[filePath] ? 0
@fileSaveTimes[filePath] = Date.now()
... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 2a687553b7f81e5b904b3b0c778236076428634b | 474 | https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/main.coffee | 9 | 58 |
gandm/language-babel:lib/main.coffee:2:raw_corpus | raw_corpus | @transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'source-preview-babel':
"Both vie to preview the same file."
's... | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 2a687553b7f81e5b904b3b0c778236076428634b | 474 | https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/main.coffee | 59 | 93 | ||
gandm/language-babel:lib/main.coffee:2:completion | completion | @transpiler.stopAllTranspilerTask()
@transpiler.disposables.dispose()
@ttlGrammar.destroy()
# warns if an activated package is on the incompatible list
isPackageCompatible: (activatedPackage) ->
incompatiblePackages = {
'source-preview-babel':
"Both vie to preview the same file."
's... | \nAs language-babel also attempts to do auto indentation using
\nstandard atom API's, this creates a potential conflict."
}
for incompatiblePackage, reason of incompatiblePackages
if activatedPackage.name is incompatiblePackage
atom.notifications.addInfo 'Incompatible Package Detected',
... | CoffeeScript | CoffeeScript | gandm/language-babel | lib/main.coffee | MIT | 2a687553b7f81e5b904b3b0c778236076428634b | 474 | https://github.com/gandm/language-babel/blob/2a687553b7f81e5b904b3b0c778236076428634b/lib/main.coffee | 59 | 93 |
jianliaoim/talk-os:talk-web/client/module/avatar.coffee:1:raw_corpus | raw_corpus | cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'avatar'
mixins: [ PureRenderMixin ]
propTypes:
src: T.string
size: T.oneO... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/avatar.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/avatar.coffee | 1 | 49 | ||
jianliaoim/talk-os:talk-web/client/module/avatar.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'avatar'
mixins: [ PureRende... | var PureRenderMixin, React, T, assign, cx, i;
cx = require('classnames');
React = require('react');
assign = require('object-assign');
PureRenderMixin = require('react-addons-pure-render-mixin');
({i} = React.DOM);
T = React.PropTypes;
module.exports = React.createClass({
displayName: 'avatar',
mixins: [Pure... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/avatar.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/avatar.coffee | 1 | 49 |
jianliaoim/talk-os:talk-web/client/module/avatar.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PureRenderMixin, React, T, assign, cx, i;
cx = require('classnames');
React = require('react');
assign = require('object-assign');
PureRenderMixin = require('react-addons-pure-render-mixin');
({i} = React.DOM);
T = React.PropTypes;
module.exports = React... | cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'avatar'
mixins: [ PureRenderMixin ]
propTypes:
src: T.string
size: T.oneO... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/avatar.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/avatar.coffee | 1 | 49 |
jianliaoim/talk-os:talk-web/client/module/avatar.coffee:1:completion | completion | cx = require 'classnames'
React = require 'react'
assign = require 'object-assign'
PureRenderMixin = require 'react-addons-pure-render-mixin'
{ i } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'avatar'
mixins: [ PureRenderMixin ]
propTypes:
src: T.string
size: T.oneO... | size: 'normal'
shape: ''
onClick: (->)
className: ''
getClassName: ->
cx @props.className, 'avatar', (if @props.size isnt 'normal' then @props.size), @props.shape
getStyle: ->
if @props.backgroundColor? and not @props.src
backgroundColor =
backgroundColor: @props.backgroundColor
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/avatar.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/avatar.coffee | 1 | 49 |
elving/swag:src/swag.inflections.coffee:1:raw_corpus | raw_corpus | Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat count
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
, ['number', 'string', 'string']
Swag.addHelper 'ordinalize', (value) ->
... | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | e9c8788dfc9f640038c00eaafe33f4137ff5f465 | 675 | https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.inflections.coffee | 1 | 19 | ||
elving/swag:src/swag.inflections.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat count
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
, ['number', 'stri... | var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
count = parseFloat(count);
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return word;
} else {
return `${count} ${word}`;
}
}, ['n... | CoffeeScript | JavaScript | elving/swag | src/swag.inflections.coffee | MIT | e9c8788dfc9f640038c00eaafe33f4137ff5f465 | 675 | https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.inflections.coffee | 1 | 19 |
elving/swag:src/swag.inflections.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
count = parseFloat(count);
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return wor... | Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat count
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
, ['number', 'string', 'string']
Swag.addHelper 'ordinalize', (value) ->
... | JavaScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | e9c8788dfc9f640038c00eaafe33f4137ff5f465 | 675 | https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.inflections.coffee | 1 | 19 |
elving/swag:src/swag.inflections.coffee:1:completion | completion | Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat count
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
, ['number', 'string', 'string']
Swag.addHelper 'ordinalize', (value) ->
... | if (normal % 100) in [11..13]
"#{value}th"
else
switch normal % 10
when 1 then "#{value}st"
when 2 then "#{value}nd"
when 3 then "#{value}rd"
else "#{value}th"
, 'number' | CoffeeScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | e9c8788dfc9f640038c00eaafe33f4137ff5f465 | 675 | https://github.com/elving/swag/blob/e9c8788dfc9f640038c00eaafe33f4137ff5f465/src/swag.inflections.coffee | 1 | 19 |
elving/swag:src/swag.inflections.coffee:1:raw_corpus | raw_corpus | Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat Utils.result count
singular = Utils.result singular
plural = Utils.result plural
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #... | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 1dab7399e1ac6127c7b2cde8d518f46c85838801 | 675 | https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.inflections.coffee | 1 | 21 | ||
elving/swag:src/swag.inflections.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat Utils.result count
singular = Utils.result singular
plural = Utils.result plural
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefine... | var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
count = parseFloat(Utils.result(count));
singular = Utils.result(singular);
plural = Utils.result(plural);
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || includ... | CoffeeScript | JavaScript | elving/swag | src/swag.inflections.coffee | MIT | 1dab7399e1ac6127c7b2cde8d518f46c85838801 | 675 | https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.inflections.coffee | 1 | 21 |
elving/swag:src/swag.inflections.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
count = parseFloat(Utils.result(count));
singular = Utils.result(singular);
plural = Utils.result(plural);
word = count > 1 || count === 0 ? plural... | Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat Utils.result count
singular = Utils.result singular
plural = Utils.result plural
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #... | JavaScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 1dab7399e1ac6127c7b2cde8d518f46c85838801 | 675 | https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.inflections.coffee | 1 | 21 |
elving/swag:src/swag.inflections.coffee:1:completion | completion | Swag.addHelper 'inflect', (count, singular, plural, include) ->
count = parseFloat Utils.result count
singular = Utils.result singular
plural = Utils.result plural
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #... | normal = Math.abs Math.round value
if (normal % 100) in [11..13]
"#{value}th"
else
switch normal % 10
when 1 then "#{value}st"
when 2 then "#{value}nd"
when 3 then "#{value}rd"
else "#{value}th"
, 'number' | CoffeeScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 1dab7399e1ac6127c7b2cde8d518f46c85838801 | 675 | https://github.com/elving/swag/blob/1dab7399e1ac6127c7b2cde8d518f46c85838801/src/swag.inflections.coffee | 1 | 21 |
elving/swag:src/swag.inflections.coffee:1:raw_corpus | raw_corpus | Swag.addHelper 'inflect', (count, singular, plural, include) ->
unless (Utils.isUndefined count) and (Utils.isUndefined singular) and (Utils.isUndefined plural)
count = parseFloat Utils.result count
singular = Utils.result singular
plural = Utils.result plural
word = if count > 1 or ... | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1 | 675 | https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.inflections.coffee | 1 | 25 | ||
elving/swag:src/swag.inflections.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Swag.addHelper 'inflect', (count, singular, plural, include) ->
unless (Utils.isUndefined count) and (Utils.isUndefined singular) and (Utils.isUndefined plural)
count = parseFloat Utils.result count
singular = Utils.result singular
plu... | var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
if (!((Utils.isUndefined(count)) && (Utils.isUndefined(singular)) && (Utils.isUndefined(plural)))) {
count = parseFloat(Utils.result(count));
singular = Utils.result(singular);
plural = Utils.resu... | CoffeeScript | JavaScript | elving/swag | src/swag.inflections.coffee | MIT | 3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1 | 675 | https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.inflections.coffee | 1 | 25 |
elving/swag:src/swag.inflections.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
if (!((Utils.isUndefined(count)) && (Utils.isUndefined(singular)) && (Utils.isUndefined(plural)))) {
count = parseFloat(Utils.result(count));
sin... | Swag.addHelper 'inflect', (count, singular, plural, include) ->
unless (Utils.isUndefined count) and (Utils.isUndefined singular) and (Utils.isUndefined plural)
count = parseFloat Utils.result count
singular = Utils.result singular
plural = Utils.result plural
word = if count > 1 or ... | JavaScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1 | 675 | https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.inflections.coffee | 1 | 25 |
elving/swag:src/swag.inflections.coffee:1:completion | completion | Swag.addHelper 'inflect', (count, singular, plural, include) ->
unless (Utils.isUndefined count) and (Utils.isUndefined singular) and (Utils.isUndefined plural)
count = parseFloat Utils.result count
singular = Utils.result singular
plural = Utils.result plural
word = if count > 1 or ... | value = parseFloat Utils.result value
normal = Math.abs Math.round value
if (normal % 100) in [11..13]
"#{value}th"
else
switch normal % 10
when 1 then "#{value}st"
when 2 then "#{value}nd"
when 3 then "#{value}rd"
... | CoffeeScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1 | 675 | https://github.com/elving/swag/blob/3a5249a04c2d7c27acb8834dc3e31ae0f56ccfd1/src/swag.inflections.coffee | 1 | 25 |
elving/swag:src/swag.inflections.coffee:1:raw_corpus | raw_corpus | Swag.addHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.addHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value
if (normal % 100) i... | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | f17d2de491f4ec174ae77b59461eb8c9f823302c | 675 | https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.inflections.coffee | 1 | 15 | ||
elving/swag:src/swag.inflections.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Swag.addHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.addHelper 'ordinalize', (value) ->
no... | var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return word;
} else {
return `${count} ${word}`;
}
});
Swag.addHelper('ordinalize', f... | CoffeeScript | JavaScript | elving/swag | src/swag.inflections.coffee | MIT | f17d2de491f4ec174ae77b59461eb8c9f823302c | 675 | https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
Swag.addHelper('inflect', function(count, singular, plural, include) {
var word;
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return word;
} else {
return `${c... | Swag.addHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.addHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value
if (normal % 100) i... | JavaScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | f17d2de491f4ec174ae77b59461eb8c9f823302c | 675 | https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:completion | completion | Swag.addHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.addHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value | if (normal % 100) in [11..13]
"#{value}th"
else
switch normal % 10
when 1 then "#{value}st"
when 2 then "#{value}nd"
when 3 then "#{value}rd"
else "#{value}th" | CoffeeScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | f17d2de491f4ec174ae77b59461eb8c9f823302c | 675 | https://github.com/elving/swag/blob/f17d2de491f4ec174ae77b59461eb8c9f823302c/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:raw_corpus | raw_corpus | Swag.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.registerHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value
if (norma... | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17 | 675 | https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.inflections.coffee | 1 | 15 | ||
elving/swag:src/swag.inflections.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Swag.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.registerHelper 'ordinalize', (value)... | var indexOf = [].indexOf;
Swag.registerHelper('inflect', function(count, singular, plural, include) {
var word;
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return word;
} else {
return `${count} ${word}`;
}
});
Swag.registerHelper('ordi... | CoffeeScript | JavaScript | elving/swag | src/swag.inflections.coffee | MIT | 65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17 | 675 | https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
Swag.registerHelper('inflect', function(count, singular, plural, include) {
var word;
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return word;
} else {
return... | Swag.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.registerHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value
if (norma... | JavaScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17 | 675 | https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:completion | completion | Swag.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Swag.registerHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value | if (normal % 100) in [11..13]
"#{value}th"
else
switch normal % 10
when 1 then "#{value}st"
when 2 then "#{value}nd"
when 3 then "#{value}rd"
else "#{value}th" | CoffeeScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17 | 675 | https://github.com/elving/swag/blob/65fa361b1dbaa9c28ca8dbf5cad24d741f96ff17/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:raw_corpus | raw_corpus | Handlebars.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Handlebars.registerHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value
... | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 163af3a070eefe79a32c8239884929e0cae1f589 | 675 | https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.inflections.coffee | 1 | 15 | ||
elving/swag:src/swag.inflections.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Handlebars.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Handlebars.registerHelper 'ordinali... | var indexOf = [].indexOf;
Handlebars.registerHelper('inflect', function(count, singular, plural, include) {
var word;
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return word;
} else {
return `${count} ${word}`;
}
});
Handlebars.register... | CoffeeScript | JavaScript | elving/swag | src/swag.inflections.coffee | MIT | 163af3a070eefe79a32c8239884929e0cae1f589 | 675 | https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var indexOf = [].indexOf;
Handlebars.registerHelper('inflect', function(count, singular, plural, include) {
var word;
word = count > 1 || count === 0 ? plural : singular;
if (Utils.isUndefined(include) || include === false) {
return word;
} else {
... | Handlebars.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Handlebars.registerHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value
... | JavaScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 163af3a070eefe79a32c8239884929e0cae1f589 | 675 | https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.inflections.coffee | 1 | 15 |
elving/swag:src/swag.inflections.coffee:1:completion | completion | Handlebars.registerHelper 'inflect', (count, singular, plural, include) ->
word = if count > 1 or count is 0 then plural else singular
if Utils.isUndefined(include) or include is false then word else "#{count} #{word}"
Handlebars.registerHelper 'ordinalize', (value) ->
normal = Math.abs Math.round value | if (normal % 100) in [11..13]
"#{value}th"
else
switch normal % 10
when 1 then "#{value}st"
when 2 then "#{value}nd"
when 3 then "#{value}rd"
else "#{value}th" | CoffeeScript | CoffeeScript | elving/swag | src/swag.inflections.coffee | MIT | 163af3a070eefe79a32c8239884929e0cae1f589 | 675 | https://github.com/elving/swag/blob/163af3a070eefe79a32c8239884929e0cae1f589/src/swag.inflections.coffee | 1 | 15 |
buttercoin/buttercoin:lib/api/api_protocol.coffee:1:raw_corpus | raw_corpus | Protocol = require('../ews/protocol')
operations = require('../operations')
module.exports = class ApiProtocol extends Protocol
mkAcctListeners: (account_id) =>
mkOp = (op) -> "#{op}?account=#{account_id}"
[ [mkOp(operations.ADD_DEPOSIT), @report_deposit]
[mkOp(operations.WITHDRAW_FUNDS), @report_withd... | CoffeeScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 1 | 50 | ||
buttercoin/buttercoin:lib/api/api_protocol.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Protocol = require('../ews/protocol')
operations = require('../operations')
module.exports = class ApiProtocol extends Protocol
mkAcctListeners: (account_id) =>
mkOp = (op) -> "#{op}?account=#{account_id}"
[ [mkOp(operations.ADD_DEPOSIT), @report_depos... | var ApiProtocol, Protocol, operations,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
Protocol = require('../ews/protocol');
operations = require('../operations');
module.exports = ApiProtocol = c... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 1 | 50 |
buttercoin/buttercoin:lib/api/api_protocol.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ApiProtocol, Protocol, operations,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
Protocol = require('../ews/protocol');
operations = requ... | Protocol = require('../ews/protocol')
operations = require('../operations')
module.exports = class ApiProtocol extends Protocol
mkAcctListeners: (account_id) =>
mkOp = (op) -> "#{op}?account=#{account_id}"
[ [mkOp(operations.ADD_DEPOSIT), @report_deposit]
[mkOp(operations.WITHDRAW_FUNDS), @report_withd... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 1 | 50 |
buttercoin/buttercoin:lib/api/api_protocol.coffee:1:completion | completion | Protocol = require('../ews/protocol')
operations = require('../operations')
module.exports = class ApiProtocol extends Protocol
mkAcctListeners: (account_id) =>
mkOp = (op) -> "#{op}?account=#{account_id}"
[ [mkOp(operations.ADD_DEPOSIT), @report_deposit]
[mkOp(operations.WITHDRAW_FUNDS), @report_withd... | report_withdrawl: =>
report_user_order: =>
report_user_cancelled_order: =>
handle_parsed_data: (data) =>
if data.kind is 'AUTH'
@handle_auth_request(data)
else
@connection.send_obj
operation: data
result: 'bad_request'
handle_auth_request: (data) =>
@warn "HANDLING AUTH... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 1 | 50 |
buttercoin/buttercoin:lib/api/api_protocol.coffee:2:raw_corpus | raw_corpus | @connection.send_obj
operation: data
result: 'success'
@warn "DONE"
handle_auth_failure: (data) =>
@info "AUTH FAILURE"
@connection.send_obj
operation: data
result: 'failure'
handle_close: =>
for x in @mkGeneralListeners()
@event_source.removeListener(x...)
if @a... | CoffeeScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 51 | 69 | ||
buttercoin/buttercoin:lib/api/api_protocol.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@connection.send_obj
operation: data
result: 'success'
@warn "DONE"
handle_auth_failure: (data) =>
@info "AUTH FAILURE"
@connection.send_obj
operation: data
result: 'failure'
handle_close: =>
for x in @mkGeneralListen... | this.connection.send_obj({
operation: data,
result: 'success'
});
this.warn("DONE");
({
handle_auth_failure: (data) => {
this.info("AUTH FAILURE");
return this.connection.send_obj({
operation: data,
result: 'failure'
});
},
handle_close: () => {
var i, j, len, len1, ref, ref1, re... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 51 | 69 |
buttercoin/buttercoin:lib/api/api_protocol.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.connection.send_obj({
operation: data,
result: 'success'
});
this.warn("DONE");
({
handle_auth_failure: (data) => {
this.info("AUTH FAILURE");
return this.connection.send_obj({
operation: data,
result: 'failure'
});
},
handl... | @connection.send_obj
operation: data
result: 'success'
@warn "DONE"
handle_auth_failure: (data) =>
@info "AUTH FAILURE"
@connection.send_obj
operation: data
result: 'failure'
handle_close: =>
for x in @mkGeneralListeners()
@event_source.removeListener(x...)
if @a... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 51 | 69 |
buttercoin/buttercoin:lib/api/api_protocol.coffee:2:completion | completion | @connection.send_obj
operation: data
result: 'success'
@warn "DONE"
handle_auth_failure: (data) =>
@info "AUTH FAILURE"
@connection.send_obj
operation: data | result: 'failure'
handle_close: =>
for x in @mkGeneralListeners()
@event_source.removeListener(x...)
if @account_id
for x in @mkAcctListeners(@account_id)
@event_source.removeListener(x...) | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/api/api_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/api/api_protocol.coffee | 51 | 69 |
rs/pushd:lib/pushservices.coffee:1:raw_corpus | raw_corpus | class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service
getService: (protocol) ->
return @services[protocol]
push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =>
if info then @services[info.proto]?.push(su... | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices.coffee | 1 | 15 | ||
rs/pushd:lib/pushservices.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service
getService: (protocol) ->
return @services[protocol]
push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =... | var PushServices;
PushServices = (function() {
class PushServices {
addService(protocol, service) {
return this.services[protocol] = service;
}
getService(protocol) {
return this.services[protocol];
}
push(subscriber, subOptions, payload, cb) {
return subscriber.get((info) => ... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices.coffee | 1 | 15 |
rs/pushd:lib/pushservices.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServices;
PushServices = (function() {
class PushServices {
addService(protocol, service) {
return this.services[protocol] = service;
}
getService(protocol) {
return this.services[protocol];
}
push(subscriber, subOptions... | class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service
getService: (protocol) ->
return @services[protocol]
push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =>
if info then @services[info.proto]?.push(su... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices.coffee | 1 | 15 |
rs/pushd:lib/pushservices.coffee:1:completion | completion | class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service
getService: (protocol) -> | return @services[protocol]
push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =>
if info then @services[info.proto]?.push(subscriber, subOptions, payload)
cb() if cb
exports.PushServices = PushServices | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices.coffee | 1 | 15 |
rs/pushd:lib/pushservices.coffee:1:raw_corpus | raw_corpus | class PushServiceAPNS
constructor: (conf, @logger) ->
conf.errorCallback = (errCode, note) =>
@logger?.error("APNS Error #{errCode} for subscriber #{note?.device?.subscriberId}")
@driver = new apns.Connection(conf)
push: (subscriber, subOptions, payload) ->
subscriber.get (i... | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 7 | 25 | ||
rs/pushd:lib/pushservices.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class PushServiceAPNS
constructor: (conf, @logger) ->
conf.errorCallback = (errCode, note) =>
@logger?.error("APNS Error #{errCode} for subscriber #{note?.device?.subscriberId}")
@driver = new apns.Connection(conf)
push: (subs... | var PushServiceAPNS;
PushServiceAPNS = class PushServiceAPNS {
constructor(conf, logger) {
this.logger = logger;
conf.errorCallback = (errCode, note) => {
var ref, ref1;
return (ref = this.logger) != null ? ref.error(`APNS Error ${errCode} for subscriber ${note != null ? (ref1 = note.device) != n... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 7 | 25 |
rs/pushd:lib/pushservices.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceAPNS;
PushServiceAPNS = class PushServiceAPNS {
constructor(conf, logger) {
this.logger = logger;
conf.errorCallback = (errCode, note) => {
var ref, ref1;
return (ref = this.logger) != null ? ref.error(`APNS Error ${errCode} fo... | class PushServiceAPNS
constructor: (conf, @logger) ->
conf.errorCallback = (errCode, note) =>
@logger?.error("APNS Error #{errCode} for subscriber #{note?.device?.subscriberId}")
@driver = new apns.Connection(conf)
push: (subscriber, subOptions, payload) ->
subscriber.get (i... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 7 | 25 |
rs/pushd:lib/pushservices.coffee:1:completion | completion | class PushServiceAPNS
constructor: (conf, @logger) ->
conf.errorCallback = (errCode, note) =>
@logger?.error("APNS Error #{errCode} for subscriber #{note?.device?.subscriberId}")
@driver = new apns.Connection(conf)
push: (subscriber, subOptions, payload) ->
subscriber.get (i... | note.device = new apns.Device(info.token)
note.device.subscriberId = subscriber.id # used for error logging
if not (subOptions & event.OPTION_IGNORE_MESSAGE) and alert = payload.localizedMessage(info.lang)
note.alert = alert
note.badge = badge if not isNaN(badge = par... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 7 | 25 |
rs/pushd:lib/pushservices.coffee:2:raw_corpus | raw_corpus | class PushServiceC2DM
constructor: (conf, @logger) ->
conf.concurrency ?= 10
conf.keepAlive = true
@driver = new c2dm.C2DM(conf)
@driver.login (err, token) =>
if err then throw Error(err)
[queuedTasks, @queue] = [@queue, async.queue((=> @_pushTask.apply(@, arg... | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 28 | 65 | ||
rs/pushd:lib/pushservices.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class PushServiceC2DM
constructor: (conf, @logger) ->
conf.concurrency ?= 10
conf.keepAlive = true
@driver = new c2dm.C2DM(conf)
@driver.login (err, token) =>
if err then throw Error(err)
[queuedTasks, @... | var PushServiceC2DM;
PushServiceC2DM = class PushServiceC2DM {
constructor(conf, logger) {
this.logger = logger;
if (conf.concurrency == null) {
conf.concurrency = 10;
}
conf.keepAlive = true;
this.driver = new c2dm.C2DM(conf);
this.driver.login((err, token) => {
var i, len, queue... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 28 | 65 |
rs/pushd:lib/pushservices.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceC2DM;
PushServiceC2DM = class PushServiceC2DM {
constructor(conf, logger) {
this.logger = logger;
if (conf.concurrency == null) {
conf.concurrency = 10;
}
conf.keepAlive = true;
this.driver = new c2dm.C2DM(conf);
this... | class PushServiceC2DM
constructor: (conf, @logger) ->
conf.concurrency ?= 10
conf.keepAlive = true
@driver = new c2dm.C2DM(conf)
@driver.login (err, token) =>
if err then throw Error(err)
[queuedTasks, @queue] = [@queue, async.queue((=> @_pushTask.apply(@, arg... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 28 | 65 |
rs/pushd:lib/pushservices.coffee:2:completion | completion | class PushServiceC2DM
constructor: (conf, @logger) ->
conf.concurrency ?= 10
conf.keepAlive = true
@driver = new c2dm.C2DM(conf)
@driver.login (err, token) =>
if err then throw Error(err)
[queuedTasks, @queue] = [@queue, async.queue((=> @_pushTask.apply(@, arg... | _pushTask: (task, done) ->
task.subscriber.get (info) =>
note =
registration_id: info.token
collapse_key: task.payload.event.name
if not (task.subOptions & event.OPTION_IGNORE_MESSAGE)
if title = task.payload.localizedTitle(info.lang)
... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 28 | 65 |
rs/pushd:lib/pushservices.coffee:3:raw_corpus | raw_corpus | class PushServiceMPNS
constructor: (@conf, @logger) ->
push: (subscriber, subOptions, payload) ->
# TO BE IMPLEMENTED | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 68 | 72 | ||
rs/pushd:lib/pushservices.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class PushServiceMPNS
constructor: (@conf, @logger) ->
push: (subscriber, subOptions, payload) ->
# TO BE IMPLEMENTED
``` | var PushServiceMPNS;
PushServiceMPNS = class PushServiceMPNS {
constructor(conf, logger) {
this.conf = conf;
this.logger = logger;
}
push(subscriber, subOptions, payload) {}
};
// TO BE IMPLEMENTED | CoffeeScript | JavaScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 68 | 72 |
rs/pushd:lib/pushservices.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceMPNS;
PushServiceMPNS = class PushServiceMPNS {
constructor(conf, logger) {
this.conf = conf;
this.logger = logger;
}
push(subscriber, subOptions, payload) {}
};
// TO BE IMPLEMENTED
``` | class PushServiceMPNS
constructor: (@conf, @logger) ->
push: (subscriber, subOptions, payload) ->
# TO BE IMPLEMENTED | JavaScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 68 | 72 |
rs/pushd:lib/pushservices.coffee:3:completion | completion | class PushServiceMPNS
constructor: (@conf, @logger) -> | push: (subscriber, subOptions, payload) ->
# TO BE IMPLEMENTED | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 68 | 72 |
rs/pushd:lib/pushservices.coffee:4:raw_corpus | raw_corpus | class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service
push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =>
if info then @services[info.proto]?.push(subscriber, subOptions, payload)
cb() if cb
exports.Pus... | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 75 | 86 | ||
rs/pushd:lib/pushservices.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service
push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =>
if info then @services[info.proto]?.push(subscriber,... | var PushServices;
PushServices = (function() {
class PushServices {
addService(protocol, service) {
return this.services[protocol] = service;
}
push(subscriber, subOptions, payload, cb) {
return subscriber.get((info) => {
var ref;
if (info) {
if ((ref = this.service... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 75 | 86 |
rs/pushd:lib/pushservices.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServices;
PushServices = (function() {
class PushServices {
addService(protocol, service) {
return this.services[protocol] = service;
}
push(subscriber, subOptions, payload, cb) {
return subscriber.get((info) => {
var ref... | class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service
push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =>
if info then @services[info.proto]?.push(subscriber, subOptions, payload)
cb() if cb
exports.Pus... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 75 | 86 |
rs/pushd:lib/pushservices.coffee:4:completion | completion | class PushServices
services: {}
addService: (protocol, service) ->
@services[protocol] = service | push: (subscriber, subOptions, payload, cb) ->
subscriber.get (info) =>
if info then @services[info.proto]?.push(subscriber, subOptions, payload)
cb() if cb
exports.PushServices = PushServices | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 75 | 86 |
rs/pushd:lib/pushservices.coffee:5:raw_corpus | raw_corpus | exports.getPushServices = (conf, logger) ->
services = new PushServices()
services.addService('apns', new PushServiceAPNS(conf.apns, logger)) if conf.apns
services.addService('c2dm', new PushServiceC2DM(conf.c2dm, logger)) if conf.c2dm
services.addService('mpns', new PushServiceMPNS(conf.mpns, logger)) ... | CoffeeScript | rs/pushd | lib/pushservices.coffee | MIT | 83d119660e4c12cd867f1184a2a672226935114f | 1,157 | https://github.com/rs/pushd/blob/83d119660e4c12cd867f1184a2a672226935114f/lib/pushservices.coffee | 88 | 93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.