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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:completion | completion | # matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1) | exports.stripPrefix = (str) ->
return str.replace prefixMatch, ''
exports.parseNumbers = (str) ->
if !isNaN str
str = if str % 1 == 0 then parseInt str, 10 else parseFloat str
return str | CoffeeScript | CoffeeScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | 9678bba6ee805685781d69053c271129d25c5647 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/9678bba6ee805685781d69053c271129d25c5647/src/processors.coffee | 1 | 16 |
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:raw_corpus | raw_corpus | # matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1)
exports.stripPrefix = (str) ->
return str.replace(prefixMatch, '')
exports.pars... | CoffeeScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | a01d49f45388d2c0db4e47a0342bbec67988d507 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/a01d49f45388d2c0db4e47a0342bbec67988d507/src/processors.coffee | 1 | 16 | ||
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1)
exports.stripPrefix = (st... | // matches all xml prefixes, except for `xmlns:`
var prefixMatch;
prefixMatch = new RegExp(/(?!xmlns)^.*:/);
exports.normalize = function(str) {
return str.toLowerCase();
};
exports.firstCharLowerCase = function(str) {
return str.charAt(0).toLowerCase() + str.slice(1);
};
exports.stripPrefix = function(str) {
... | CoffeeScript | JavaScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | a01d49f45388d2c0db4e47a0342bbec67988d507 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/a01d49f45388d2c0db4e47a0342bbec67988d507/src/processors.coffee | 1 | 16 |
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// matches all xml prefixes, except for `xmlns:`
var prefixMatch;
prefixMatch = new RegExp(/(?!xmlns)^.*:/);
exports.normalize = function(str) {
return str.toLowerCase();
};
exports.firstCharLowerCase = function(str) {
return str.charAt(0).toLowerCase() + st... | # matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1)
exports.stripPrefix = (str) ->
return str.replace(prefixMatch, '')
exports.pars... | JavaScript | CoffeeScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | a01d49f45388d2c0db4e47a0342bbec67988d507 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/a01d49f45388d2c0db4e47a0342bbec67988d507/src/processors.coffee | 1 | 16 |
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:completion | completion | # matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1) | exports.stripPrefix = (str) ->
return str.replace(prefixMatch, '')
exports.parseNumbers = (str) ->
if (!isNaN(str))
str = if str%1==0 then parseInt(str, 10) else parseFloat(str);
return str | CoffeeScript | CoffeeScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | a01d49f45388d2c0db4e47a0342bbec67988d507 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/a01d49f45388d2c0db4e47a0342bbec67988d507/src/processors.coffee | 1 | 16 |
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:raw_corpus | raw_corpus | # matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1)
exports.stripPrefix = (str) ->
return str.replace(prefixMatch, '') | CoffeeScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | 83f18688dabdcda78a089c7adf54f1cbafd4e150 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/83f18688dabdcda78a089c7adf54f1cbafd4e150/src/processors.coffee | 1 | 11 | ||
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1)
exports.stripPrefix = (st... | // matches all xml prefixes, except for `xmlns:`
var prefixMatch;
prefixMatch = new RegExp(/(?!xmlns)^.*:/);
exports.normalize = function(str) {
return str.toLowerCase();
};
exports.firstCharLowerCase = function(str) {
return str.charAt(0).toLowerCase() + str.slice(1);
};
exports.stripPrefix = function(str) {
... | CoffeeScript | JavaScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | 83f18688dabdcda78a089c7adf54f1cbafd4e150 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/83f18688dabdcda78a089c7adf54f1cbafd4e150/src/processors.coffee | 1 | 11 |
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// matches all xml prefixes, except for `xmlns:`
var prefixMatch;
prefixMatch = new RegExp(/(?!xmlns)^.*:/);
exports.normalize = function(str) {
return str.toLowerCase();
};
exports.firstCharLowerCase = function(str) {
return str.charAt(0).toLowerCase() + st... | # matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase()
exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1)
exports.stripPrefix = (str) ->
return str.replace(prefixMatch, '') | JavaScript | CoffeeScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | 83f18688dabdcda78a089c7adf54f1cbafd4e150 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/83f18688dabdcda78a089c7adf54f1cbafd4e150/src/processors.coffee | 1 | 11 |
Leonidas-from-XIV/node-xml2js:src/processors.coffee:1:completion | completion | # matches all xml prefixes, except for `xmlns:`
prefixMatch = new RegExp /(?!xmlns)^.*:/
exports.normalize = (str) ->
return str.toLowerCase() | exports.firstCharLowerCase = (str) ->
return str.charAt(0).toLowerCase() + str.slice(1)
exports.stripPrefix = (str) ->
return str.replace(prefixMatch, '') | CoffeeScript | CoffeeScript | Leonidas-from-XIV/node-xml2js | src/processors.coffee | MIT | 83f18688dabdcda78a089c7adf54f1cbafd4e150 | 4,965 | https://github.com/Leonidas-from-XIV/node-xml2js/blob/83f18688dabdcda78a089c7adf54f1cbafd4e150/src/processors.coffee | 1 | 11 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 1 | 50 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:1:completion | completion | ###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | link: (scope, element, attrs) ->
$element = $(element)
$widgetBody = $element.parent()
sizer = ->
widgetBodyHeight = $widgetBody.height()
widgetBodyWidth = $widgetBody.width()
return if widgetBodyHeight == 0
numberWid... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 1 | 50 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:2:raw_corpus | raw_corpus | numberWidth = widgetBodyWidth
numberHeight = widgetBodyHeight / 2
else if scope.numberCount == 4
numberWidth = widgetBodyWidth / 2
numberHeight = widgetBodyHeight / 2 | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 51 | 55 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:2:completion | completion | numberWidth = widgetBodyWidth
numberHeight = widgetBodyHeight / 2 | else if scope.numberCount == 4
numberWidth = widgetBodyWidth / 2
numberHeight = widgetBodyHeight / 2 | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 51 | 55 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:raw_corpus | raw_corpus | if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
$widgetBody.css('overflow-y', 'hidden')
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
... | var currentHeight, currentWidth, fontSize, h1, iterations, sizeMe, spans;
if (scope.numberCount <= 4 && scope.autoSize !== false) {
$element.addClass('auto-sized');
$element.css('width', Math.floor(numberWidth) + 'px');
$element.css('height', Math.floor(numberHeight) + 'px');
$widgetBody.css('overflow-y', 'hid... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var currentHeight, currentWidth, fontSize, h1, iterations, sizeMe, spans;
if (scope.numberCount <= 4 && scope.autoSize !== false) {
$element.addClass('auto-sized');
$element.css('width', Math.floor(numberWidth) + 'px');
$element.css('height', Math.floor(numb... | if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
$widgetBody.css('overflow-y', 'hidden')
... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:completion | completion | if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
$widgetBody.css('overflow-y', 'hidden')
... | h1.css('font-size', fontSize + 'px')
h1.css('line-height', fontSize + 'px')
spans.css('font-size', fontSize * 0.75 + 'px')
iterations++
currentWidth = 0
if scope.isHorizontal
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:4:raw_corpus | raw_corpus | if scope.isHorizontal
iterations = 0
spanFontSize = Math.min(fontSize * 0.70, 40)
sizePrefixSuffix = ->
spans.css('font-size', spanFontSize + 'px')
iterations++
spa... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 99 | 140 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:4:completion | completion | if scope.isHorizontal
iterations = 0
spanFontSize = Math.min(fontSize * 0.70, 40)
sizePrefixSuffix = ->
spans.css('font-size', spanFontSize + 'px')
iterations++
spa... | $element.css('padding-top', (numberHeight - totalHeight) / 2.0 + 'px')
else
h1.css('line-height', numberHeight - fontSize / 2.0 + 'px')
else
return
# Update on window resizing
resizeFunction = _.debounce sizer, 100... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 99 | 140 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | aa249eacd2cdb7409ce6c4581e1cedf99c9471b7 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/aa249eacd2cdb7409ce6c4581e1cedf99c9471b7/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 1 | 50 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:1:completion | completion | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | link: (scope, element, attrs) ->
$element = $(element)
$widgetBody = $element.parent()
sizer = ->
widgetBodyHeight = $widgetBody.height()
widgetBodyWidth = $widgetBody.width()
return if widgetBodyHeight == 0
numberWid... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | aa249eacd2cdb7409ce6c4581e1cedf99c9471b7 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/aa249eacd2cdb7409ce6c4581e1cedf99c9471b7/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 1 | 50 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:raw_corpus | raw_corpus | if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
$widgetBody.css('overflow-y', 'hidden')
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | db8b70aa09f97162a8b96a446c2efd953854c036 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/db8b70aa09f97162a8b96a446c2efd953854c036/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
... | var currentWidth, fontSize, h1, iterations, sizeMe, sizePrefixSuffix, spanFontSize, spans;
if (scope.numberCount <= 4 && scope.autoSize !== false) {
$element.addClass('auto-sized');
$element.css('width', Math.floor(numberWidth) + 'px');
$element.css('height', Math.floor(numberHeight) + 'px');
$widgetBody.css('... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | db8b70aa09f97162a8b96a446c2efd953854c036 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/db8b70aa09f97162a8b96a446c2efd953854c036/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var currentWidth, fontSize, h1, iterations, sizeMe, sizePrefixSuffix, spanFontSize, spans;
if (scope.numberCount <= 4 && scope.autoSize !== false) {
$element.addClass('auto-sized');
$element.css('width', Math.floor(numberWidth) + 'px');
$element.css('height'... | if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
$widgetBody.css('overflow-y', 'hidden')
... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | db8b70aa09f97162a8b96a446c2efd953854c036 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/db8b70aa09f97162a8b96a446c2efd953854c036/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:completion | completion | if scope.numberCount <= 4 && scope.autoSize != false
$element.addClass 'auto-sized'
$element.css 'width', Math.floor(numberWidth) + 'px'
$element.css 'height', Math.floor(numberHeight) + 'px'
$widgetBody.css('overflow-y', 'hidden')
... | h1.css('line-height', fontSize + 'px')
spans.css('font-size', fontSize*.75 + 'px')
iterations++
currentWidth = 0
if scope.isHorizontal
currentWidth = h1.width()
else
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | db8b70aa09f97162a8b96a446c2efd953854c036 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/db8b70aa09f97162a8b96a446c2efd953854c036/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 57 | 97 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:4:raw_corpus | raw_corpus | # find max span width (prefix or suffix)
currentWidth = 0
spans.each -> currentWidth = Math.max(currentWidth, $(this).width())
sizePrefixSuffix()
sizePrefixSuffix() while currentWidth + 15 >= numberWidth && iteratio... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | db8b70aa09f97162a8b96a446c2efd953854c036 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/db8b70aa09f97162a8b96a446c2efd953854c036/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 99 | 133 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:4:completion | completion | # find max span width (prefix or suffix)
currentWidth = 0
spans.each -> currentWidth = Math.max(currentWidth, $(this).width())
sizePrefixSuffix()
sizePrefixSuffix() while currentWidth + 15 >= numberWidth && iteratio... | else
return
# Update on window resizing
$widgetBody.on 'resize', _.throttle(->
scope.$apply ->
sizer()
, 80)
$timeout(sizer, 10)
#
# Cleanup
#
scope.$on '$destroy', ... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | db8b70aa09f97162a8b96a446c2efd953854c036 | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/db8b70aa09f97162a8b96a446c2efd953854c036/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 99 | 133 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 1 | 43 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:1:completion | completion | ###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | orientation: '='
link: (scope, element, attrs) ->
$element = $(element)
$widgetBody = $element.parent()
scope.isHorizontal = (scope.orientation == 'horizontal')
if scope.singleNumber == true then scope.isHorizontal = !scope.isHorizontal
sizer = ->
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 1 | 43 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:2:raw_corpus | raw_corpus | if scope.isHorizontal
h1.css('display', 'inline-block')
spans.css('display', 'inline-block')
fontSize = Math.min(102, widgetBodyHeight / 2)
iterations = 0
currentWidth = 0
sizeMe = ->
... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 45 | 85 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if scope.isHorizontal
h1.css('display', 'inline-block')
spans.css('display', 'inline-block')
fontSize = Math.min(102, widgetBodyHeight / 2)
iterations = 0
... | var currentWidth, fontSize, iterations, sizeMe, sizePrefixSuffix, spanFontSize;
if (scope.isHorizontal) {
h1.css('display', 'inline-block');
spans.css('display', 'inline-block');
}
fontSize = Math.min(102, widgetBodyHeight / 2);
iterations = 0;
currentWidth = 0;
sizeMe = function() {
h1.css('font-size', font... | CoffeeScript | JavaScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 45 | 85 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var currentWidth, fontSize, iterations, sizeMe, sizePrefixSuffix, spanFontSize;
if (scope.isHorizontal) {
h1.css('display', 'inline-block');
spans.css('display', 'inline-block');
}
fontSize = Math.min(102, widgetBodyHeight / 2);
iterations = 0;
currentWidth... | if scope.isHorizontal
h1.css('display', 'inline-block')
spans.css('display', 'inline-block')
fontSize = Math.min(102, widgetBodyHeight / 2)
iterations = 0
currentWidth = 0
sizeMe = ->
... | JavaScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 45 | 85 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:2:completion | completion | if scope.isHorizontal
h1.css('display', 'inline-block')
spans.css('display', 'inline-block')
fontSize = Math.min(102, widgetBodyHeight / 2)
iterations = 0
currentWidth = 0
sizeMe = ->
... | while (currentWidth + 25 >= widgetBodyWidth || h1.height() > fontSize * 2) && iterations < 15
fontSize -= 4
sizeMe()
if scope.isHorizontal
iterations = 0
spanFontSize = Math.min(fontSize*.70, 40)
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 45 | 85 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:raw_corpus | raw_corpus | # Vertical align
totalHeight = 0
numbers.children().each -> totalHeight += $(this).height()
$element.css('padding-top', (widgetBodyHeight - totalHeight) / 2.0 + 'px')
else
h1.css('line-height', widgetBod... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 87 | 117 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/number/directives.theNumber.coffee:3:completion | completion | # Vertical align
totalHeight = 0
numbers.children().each -> totalHeight += $(this).height()
$element.css('padding-top', (widgetBodyHeight - totalHeight) / 2.0 + 'px')
else
h1.css('line-height', widgetBod... | # Update on window resizing
$widgetBody.on 'resize', _.throttle(->
scope.$apply ->
sizer()
, 80)
$timeout(sizer, 10)
#
# Cleanup
#
scope.$on '$destroy', ->
$widgetBody.off 'resize'
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/number/directives.theNumber.coffee | MIT | 14b0e411415be801f94fe13ea6f63d5ad957c2ed | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/14b0e411415be801f94fe13ea6f63d5ad957c2ed/cyclotron-site/app/widgets/number/directives.theNumber.coffee | 87 | 117 |
rs/pushd:lib/pushservices/gcm.coffee:1:raw_corpus | raw_corpus | gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key, conf.options)
@multicastQueue = {}
push: (subscriber, subOptions, payload) ->
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 1 | 50 | ||
rs/pushd:lib/pushservices/gcm.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key, conf.options)
@multicastQueue =... | var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = class PushServiceGCM {
validateToken(token) {
return token;
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if (conf.concurrency == null) {
conf.concurrency = 10;
}
this.driver = new gcm.Sender(con... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = class PushServiceGCM {
validateToken(token) {
return token;
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if (conf.concurrency == null) {
conf.concu... | gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key, conf.options)
@multicastQueue = {}
push: (subscriber, subOptions, payload) ->
... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:completion | completion | gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key, conf.options)
@multicastQueue = {}
push: (subscriber, subOptions, payload) ->
... | if subOptions?.ignore_message isnt true
if title = payload.localizedTitle(info.lang)
note.addData 'title', title
if message = payload.localizedMessage(info.lang)
note.addData 'message', message
note.addData(key, valu... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:2:raw_corpus | raw_corpus | handleResult: (result, subscriber) ->
if result.registration_id?
# Remove duplicated subscriber for one device
subscriber.delete() if result.registration_id isnt subscriber.info.token
else if result.messageId or result.message_id
# if result.canonicalRegistrationId
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 51 | 69 | ||
rs/pushd:lib/pushservices/gcm.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
handleResult: (result, subscriber) ->
if result.registration_id?
# Remove duplicated subscriber for one device
subscriber.delete() if result.registration_id isnt subscriber.info.token
else if result.messageId or result.mess... | ({
handleResult: function(result, subscriber) {
var error, ref, ref1;
if (result.registration_id != null) {
if (result.registration_id !== subscriber.info.token) {
// Remove duplicated subscriber for one device
return subscriber.delete();
}
} else if (result.messageId || result... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 51 | 69 |
rs/pushd:lib/pushservices/gcm.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
handleResult: function(result, subscriber) {
var error, ref, ref1;
if (result.registration_id != null) {
if (result.registration_id !== subscriber.info.token) {
// Remove duplicated subscriber for one device
return subscriber.dele... | handleResult: (result, subscriber) ->
if result.registration_id?
# Remove duplicated subscriber for one device
subscriber.delete() if result.registration_id isnt subscriber.info.token
else if result.messageId or result.message_id
# if result.canonicalRegistrationId
... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 51 | 69 |
rs/pushd:lib/pushservices/gcm.coffee:2:completion | completion | handleResult: (result, subscriber) ->
if result.registration_id?
# Remove duplicated subscriber for one device
subscriber.delete() if result.registration_id isnt subscriber.info.token
else if result.messageId or result.message_id
# if result.canonicalRegistrationId
... | if error is "NotRegistered" or error is "InvalidRegistration"
@logger?.warn("GCM Automatic unregistration for subscriber #{subscriber.id}")
subscriber.delete()
else
@logger?.error("GCM Error: #{error}")
exports.PushServiceGCM = PushServiceGCM | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9dc56de9da2a64903cad510d22d4d0e078a8ba0a | 1,157 | https://github.com/rs/pushd/blob/9dc56de9da2a64903cad510d22d4d0e078a8ba0a/lib/pushservices/gcm.coffee | 51 | 69 |
rs/pushd:lib/pushservices/gcm.coffee:1:raw_corpus | raw_corpus | gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
@multicastQueue = {}
push: (subscriber, subOptions, payload) ->
subscriber.... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | bfc7f67159060bdb09035d86038ae999af1e5ed3 | 1,157 | https://github.com/rs/pushd/blob/bfc7f67159060bdb09035d86038ae999af1e5ed3/lib/pushservices/gcm.coffee | 1 | 50 | ||
rs/pushd:lib/pushservices/gcm.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
@multicastQueue = {}
push:... | var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = class PushServiceGCM {
validateToken(token) {
return token;
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if (conf.concurrency == null) {
conf.concurrency = 10;
}
this.driver = new gcm.Sender(con... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | bfc7f67159060bdb09035d86038ae999af1e5ed3 | 1,157 | https://github.com/rs/pushd/blob/bfc7f67159060bdb09035d86038ae999af1e5ed3/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = class PushServiceGCM {
validateToken(token) {
return token;
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if (conf.concurrency == null) {
conf.concu... | gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
@multicastQueue = {}
push: (subscriber, subOptions, payload) ->
subscriber.... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | bfc7f67159060bdb09035d86038ae999af1e5ed3 | 1,157 | https://github.com/rs/pushd/blob/bfc7f67159060bdb09035d86038ae999af1e5ed3/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:completion | completion | gcm = require 'node-gcm'
class PushServiceGCM
validateToken: (token) ->
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
@multicastQueue = {}
push: (subscriber, subOptions, payload) ->
subscriber.... | if subOptions?.ignore_message isnt true
if title = payload.localizedTitle(info.lang)
note.addData 'title', title
if message = payload.localizedMessage(info.lang)
note.addData 'message', message
note.addData(key, valu... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | bfc7f67159060bdb09035d86038ae999af1e5ed3 | 1,157 | https://github.com/rs/pushd/blob/bfc7f67159060bdb09035d86038ae999af1e5ed3/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:raw_corpus | raw_corpus | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | ec639b547be4108e10f082ed353809a975f483ea | 1,157 | https://github.com/rs/pushd/blob/ec639b547be4108e10f082ed353809a975f483ea/lib/pushservices/gcm.coffee | 1 | 50 | ||
rs/pushd:lib/pushservices/gcm.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurren... | var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if ... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | ec639b547be4108e10f082ed353809a975f483ea | 1,157 | https://github.com/rs/pushd/blob/ec639b547be4108e10f082ed353809a975f483ea/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger,... | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | ec639b547be4108e10f082ed353809a975f483ea | 1,157 | https://github.com/rs/pushd/blob/ec639b547be4108e10f082ed353809a975f483ea/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:completion | completion | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | note = new gcm.Message()
note.collapseKey = payload.event?.name
if subOptions?.ignore_message isnt true
if title = payload.localizedTitle(info.lang)
note.addData 'title', title
if message = payload.localizedMessage(info.lang... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | ec639b547be4108e10f082ed353809a975f483ea | 1,157 | https://github.com/rs/pushd/blob/ec639b547be4108e10f082ed353809a975f483ea/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:2:raw_corpus | raw_corpus | # non multicast result
@handleResult multicastResult, message.subscribers[0]
handleResult: (result, subscriber) ->
if result.registration_id?
# Remove duplicated subscriber for one device
subscriber.delete() if result.registration_id isnt subscriber.info.token
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | ec639b547be4108e10f082ed353809a975f483ea | 1,157 | https://github.com/rs/pushd/blob/ec639b547be4108e10f082ed353809a975f483ea/lib/pushservices/gcm.coffee | 51 | 71 | ||
rs/pushd:lib/pushservices/gcm.coffee:2:completion | completion | # non multicast result
@handleResult multicastResult, message.subscribers[0]
handleResult: (result, subscriber) ->
if result.registration_id?
# Remove duplicated subscriber for one device
subscriber.delete() if result.registration_id isnt subscriber.info.token
... | else
error = result.error or result.errorCode
if error is "NotRegistered" or error is "InvalidRegistration"
@logger?.warn("GCM Automatic unregistration for subscriber #{subscriber.id}")
subscriber.delete()
else
@logger?.error("GCM Error... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | ec639b547be4108e10f082ed353809a975f483ea | 1,157 | https://github.com/rs/pushd/blob/ec639b547be4108e10f082ed353809a975f483ea/lib/pushservices/gcm.coffee | 51 | 71 |
rs/pushd:lib/pushservices/gcm.coffee:2:raw_corpus | raw_corpus | # non multicast result
@handleResult multicastResult, message.subscribers[0]
handleResult: (result, subscriber) ->
if result.messageId or result.message_id
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 07685d91d06c7b26ea68bc9ea288acbdf8631101 | 1,157 | https://github.com/rs/pushd/blob/07685d91d06c7b26ea68bc9ea288acbdf8631101/lib/pushservices/gcm.coffee | 51 | 68 | ||
rs/pushd:lib/pushservices/gcm.coffee:2:completion | completion | # non multicast result
@handleResult multicastResult, message.subscribers[0]
handleResult: (result, subscriber) ->
if result.messageId or result.message_id
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result... | if error is "NotRegistered" or error is "InvalidRegistration"
@logger?.warn("GCM Automatic unregistration for subscriber #{subscriber.id}")
subscriber.delete()
else
@logger?.error("GCM Error: #{error}")
exports.PushServiceGCM = PushServiceGCM | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 07685d91d06c7b26ea68bc9ea288acbdf8631101 | 1,157 | https://github.com/rs/pushd/blob/07685d91d06c7b26ea68bc9ea288acbdf8631101/lib/pushservices/gcm.coffee | 51 | 68 |
rs/pushd:lib/pushservices/gcm.coffee:1:raw_corpus | raw_corpus | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9ac6d7a9d4dd1a26f83f412974816c6a9d311a72 | 1,157 | https://github.com/rs/pushd/blob/9ac6d7a9d4dd1a26f83f412974816c6a9d311a72/lib/pushservices/gcm.coffee | 1 | 50 | ||
rs/pushd:lib/pushservices/gcm.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurren... | var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if ... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9ac6d7a9d4dd1a26f83f412974816c6a9d311a72 | 1,157 | https://github.com/rs/pushd/blob/9ac6d7a9d4dd1a26f83f412974816c6a9d311a72/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger,... | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9ac6d7a9d4dd1a26f83f412974816c6a9d311a72 | 1,157 | https://github.com/rs/pushd/blob/9ac6d7a9d4dd1a26f83f412974816c6a9d311a72/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:completion | completion | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | note = new gcm.Message()
note.collapseKey = payload.event?.name
if subOptions?.ignore_message isnt true
if title = payload.localizedTitle(info.lang)
note.addData 'title', title
if message = payload.localizedMessage(info.lang... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 9ac6d7a9d4dd1a26f83f412974816c6a9d311a72 | 1,157 | https://github.com/rs/pushd/blob/9ac6d7a9d4dd1a26f83f412974816c6a9d311a72/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:raw_corpus | raw_corpus | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | af8274e23f345d1bcab2a15f465fdd2b8db90f38 | 1,157 | https://github.com/rs/pushd/blob/af8274e23f345d1bcab2a15f465fdd2b8db90f38/lib/pushservices/gcm.coffee | 1 | 50 | ||
rs/pushd:lib/pushservices/gcm.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurren... | var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if ... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | af8274e23f345d1bcab2a15f465fdd2b8db90f38 | 1,157 | https://github.com/rs/pushd/blob/af8274e23f345d1bcab2a15f465fdd2b8db90f38/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger,... | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | af8274e23f345d1bcab2a15f465fdd2b8db90f38 | 1,157 | https://github.com/rs/pushd/blob/af8274e23f345d1bcab2a15f465fdd2b8db90f38/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:completion | completion | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | note = new gcm.Message()
note.collapseKey = payload.event.name
if subOptions?.ignore_message isnt true
if title = payload.localizedTitle(info.lang)
note.addData 'title', title
if message = payload.localizedMessage(info.lang)... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | af8274e23f345d1bcab2a15f465fdd2b8db90f38 | 1,157 | https://github.com/rs/pushd/blob/af8274e23f345d1bcab2a15f465fdd2b8db90f38/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:raw_corpus | raw_corpus | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 1 | 50 | ||
rs/pushd:lib/pushservices/gcm.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurren... | var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if ... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger,... | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:1:completion | completion | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | note = new gcm.Message()
note.collapseKey = payload.event.name
if subOptions?.ignore_message isnt true
if title = payload.localizedTitle(info.lang)
note.addData 'title', title
if message = payload.localizedMessage(info.lang)... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 1 | 50 |
rs/pushd:lib/pushservices/gcm.coffee:2:raw_corpus | raw_corpus | handleResult: (result, subscriber) ->
if result.messageId or result.message_id
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if error is "NotRegistered" or error is "InvalidRegistratio... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 51 | 66 | ||
rs/pushd:lib/pushservices/gcm.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
handleResult: (result, subscriber) ->
if result.messageId or result.message_id
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if... | ({
handleResult: function(result, subscriber) {
var error, ref, ref1;
if (result.messageId || result.message_id) {
} else {
// if result.canonicalRegistrationId
// TODO: update subscriber token
error = result.error || result.errorCode;
if (error === "NotRegistered" || error === "I... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 51 | 66 |
rs/pushd:lib/pushservices/gcm.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
handleResult: function(result, subscriber) {
var error, ref, ref1;
if (result.messageId || result.message_id) {
} else {
// if result.canonicalRegistrationId
// TODO: update subscriber token
error = result.error || result.errorCo... | handleResult: (result, subscriber) ->
if result.messageId or result.message_id
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if error is "NotRegistered" or error is "InvalidRegistratio... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 51 | 66 |
rs/pushd:lib/pushservices/gcm.coffee:2:completion | completion | handleResult: (result, subscriber) ->
if result.messageId or result.message_id
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if error is "NotRegistered" or error is "InvalidRegistratio... | @logger?.warn("GCM Automatic unregistration for subscriber #{subscriber.id}")
subscriber.delete()
else
@logger?.error("GCM Error: #{error}")
exports.PushServiceGCM = PushServiceGCM | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | add90eda1d068a7aac2028a5c988ef0b5e5ad1e8 | 1,157 | https://github.com/rs/pushd/blob/add90eda1d068a7aac2028a5c988ef0b5e5ad1e8/lib/pushservices/gcm.coffee | 51 | 66 |
rs/pushd:lib/pushservices/gcm.coffee:2:raw_corpus | raw_corpus | handleResult: (result, subscriber) ->
if result.messageId
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if error is "NotRegistered" or error is "InvalidRegistration"
@l... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | d798066392af800198abb1da105fdf6ab3d5a0e6 | 1,157 | https://github.com/rs/pushd/blob/d798066392af800198abb1da105fdf6ab3d5a0e6/lib/pushservices/gcm.coffee | 51 | 66 | ||
rs/pushd:lib/pushservices/gcm.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
handleResult: (result, subscriber) ->
if result.messageId
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if error is "NotRegiste... | ({
handleResult: function(result, subscriber) {
var error, ref, ref1;
if (result.messageId) {
} else {
// if result.canonicalRegistrationId
// TODO: update subscriber token
error = result.error || result.errorCode;
if (error === "NotRegistered" || error === "InvalidRegistration") ... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | d798066392af800198abb1da105fdf6ab3d5a0e6 | 1,157 | https://github.com/rs/pushd/blob/d798066392af800198abb1da105fdf6ab3d5a0e6/lib/pushservices/gcm.coffee | 51 | 66 |
rs/pushd:lib/pushservices/gcm.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
handleResult: function(result, subscriber) {
var error, ref, ref1;
if (result.messageId) {
} else {
// if result.canonicalRegistrationId
// TODO: update subscriber token
error = result.error || result.errorCode;
if (error =... | handleResult: (result, subscriber) ->
if result.messageId
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if error is "NotRegistered" or error is "InvalidRegistration"
@l... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | d798066392af800198abb1da105fdf6ab3d5a0e6 | 1,157 | https://github.com/rs/pushd/blob/d798066392af800198abb1da105fdf6ab3d5a0e6/lib/pushservices/gcm.coffee | 51 | 66 |
rs/pushd:lib/pushservices/gcm.coffee:2:completion | completion | handleResult: (result, subscriber) ->
if result.messageId
# if result.canonicalRegistrationId
# TODO: update subscriber token
else
error = result.error or result.errorCode
if error is "NotRegistered" or error is "InvalidRegistration" | @logger?.warn("GCM Automatic unregistration for subscriber #{subscriber.id}")
subscriber.delete()
else
@logger?.error("GCM Error: #{error}")
exports.PushServiceGCM = PushServiceGCM | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | d798066392af800198abb1da105fdf6ab3d5a0e6 | 1,157 | https://github.com/rs/pushd/blob/d798066392af800198abb1da105fdf6ab3d5a0e6/lib/pushservices/gcm.coffee | 51 | 66 |
rs/pushd:lib/pushservices/gcm.coffee:1:raw_corpus | raw_corpus | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a | 1,157 | https://github.com/rs/pushd/blob/6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a/lib/pushservices/gcm.coffee | 1 | 36 | ||
rs/pushd:lib/pushservices/gcm.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurren... | var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger, tokenResolver) {
this.logger = logger;
if ... | CoffeeScript | JavaScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a | 1,157 | https://github.com/rs/pushd/blob/6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a/lib/pushservices/gcm.coffee | 1 | 36 |
rs/pushd:lib/pushservices/gcm.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PushServiceGCM, gcm;
gcm = require('node-gcm');
PushServiceGCM = (function() {
class PushServiceGCM {
validateToken(token) {
if (PushServiceGCM.prototype.tokenFormat.test(token)) {
return token;
}
}
constructor(conf, logger,... | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | JavaScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a | 1,157 | https://github.com/rs/pushd/blob/6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a/lib/pushservices/gcm.coffee | 1 | 36 |
rs/pushd:lib/pushservices/gcm.coffee:1:completion | completion | gcm = require 'node-gcm'
class PushServiceGCM
tokenFormat: /^[a-zA-Z0-9_-]+$/
validateToken: (token) ->
if PushServiceGCM::tokenFormat.test(token)
return token
constructor: (conf, @logger, tokenResolver) ->
conf.concurrency ?= 10
@driver = new gcm.Sender(conf.key)
... | note.addData 'title', title
if message = payload.localizedMessage(info.lang)
note.addData 'message', message
note.addData(key, value) for key, value of payload.data
# TODO: handle GCM multicast message
@driver.send note, [info.token], 4, (result) ... | CoffeeScript | CoffeeScript | rs/pushd | lib/pushservices/gcm.coffee | MIT | 6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a | 1,157 | https://github.com/rs/pushd/blob/6bb0b2ab8c704d96b04cfed45a0fc9c2bf10a58a/lib/pushservices/gcm.coffee | 1 | 36 |
cdglabs/apparatus:src/View/Viewer.coffee:1:raw_corpus | raw_corpus | R = require "./R"
Model = require "../Model/Model"
R.create "Viewer",
propTypes:
project: Model.Project
childContextTypes:
project: Model.Project
getChildContext: ->
project: @props.project
render: ->
R.MouseManagersWrapper {},
R.BareViewerCanvas {
element: @props.project.edit... | CoffeeScript | cdglabs/apparatus | src/View/Viewer.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Viewer.coffee | 1 | 19 | ||
cdglabs/apparatus:src/View/Viewer.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
R = require "./R"
Model = require "../Model/Model"
R.create "Viewer",
propTypes:
project: Model.Project
childContextTypes:
project: Model.Project
getChildContext: ->
project: @props.project
render: ->
R.MouseManagersWrapper {},
... | var Model, R;
R = require("./R");
Model = require("../Model/Model");
R.create("Viewer", {
propTypes: {
project: Model.Project
},
childContextTypes: {
project: Model.Project
},
getChildContext: function() {
return {
project: this.props.project
};
},
render: function() {
return ... | CoffeeScript | JavaScript | cdglabs/apparatus | src/View/Viewer.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Viewer.coffee | 1 | 19 |
cdglabs/apparatus:src/View/Viewer.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Model, R;
R = require("./R");
Model = require("../Model/Model");
R.create("Viewer", {
propTypes: {
project: Model.Project
},
childContextTypes: {
project: Model.Project
},
getChildContext: function() {
return {
project: this.props... | R = require "./R"
Model = require "../Model/Model"
R.create "Viewer",
propTypes:
project: Model.Project
childContextTypes:
project: Model.Project
getChildContext: ->
project: @props.project
render: ->
R.MouseManagersWrapper {},
R.BareViewerCanvas {
element: @props.project.edit... | JavaScript | CoffeeScript | cdglabs/apparatus | src/View/Viewer.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Viewer.coffee | 1 | 19 |
cdglabs/apparatus:src/View/Viewer.coffee:1:completion | completion | R = require "./R"
Model = require "../Model/Model"
R.create "Viewer",
propTypes:
project: Model.Project
childContextTypes: | project: Model.Project
getChildContext: ->
project: @props.project
render: ->
R.MouseManagersWrapper {},
R.BareViewerCanvas {
element: @props.project.editingElement
} | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/View/Viewer.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/View/Viewer.coffee | 1 | 19 |
jianliaoim/talk-os:talk-web/client/updater/notify.coffee:1:raw_corpus | raw_corpus | exports.create = (store, noticeData) ->
notices = store.get('notices')
hasSameText = notices and notices.find (n) ->
n.get('text') is noticeData.get('text')
if hasSameText
store
else
_noticeId = noticeData.get('_id')
store.setIn ['notices', _noticeId], noticeData
exports.remove = (store, noti... | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notify.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notify.coffee | 1 | 15 | ||
jianliaoim/talk-os:talk-web/client/updater/notify.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.create = (store, noticeData) ->
notices = store.get('notices')
hasSameText = notices and notices.find (n) ->
n.get('text') is noticeData.get('text')
if hasSameText
store
else
_noticeId = noticeData.get('_id')
store.setIn ['notice... | exports.create = function(store, noticeData) {
var _noticeId, hasSameText, notices;
notices = store.get('notices');
hasSameText = notices && notices.find(function(n) {
return n.get('text') === noticeData.get('text');
});
if (hasSameText) {
return store;
} else {
_noticeId = noticeData.get('_id')... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/updater/notify.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notify.coffee | 1 | 15 |
jianliaoim/talk-os:talk-web/client/updater/notify.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.create = function(store, noticeData) {
var _noticeId, hasSameText, notices;
notices = store.get('notices');
hasSameText = notices && notices.find(function(n) {
return n.get('text') === noticeData.get('text');
});
if (hasSameText) {
return ... | exports.create = (store, noticeData) ->
notices = store.get('notices')
hasSameText = notices and notices.find (n) ->
n.get('text') is noticeData.get('text')
if hasSameText
store
else
_noticeId = noticeData.get('_id')
store.setIn ['notices', _noticeId], noticeData
exports.remove = (store, noti... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notify.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notify.coffee | 1 | 15 |
jianliaoim/talk-os:talk-web/client/updater/notify.coffee:1:completion | completion | exports.create = (store, noticeData) ->
notices = store.get('notices')
hasSameText = notices and notices.find (n) ->
n.get('text') is noticeData.get('text')
if hasSameText
store | else
_noticeId = noticeData.get('_id')
store.setIn ['notices', _noticeId], noticeData
exports.remove = (store, noticeData) ->
_noticeId = noticeData.get('_id')
store.deleteIn ['notices', _noticeId] | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/updater/notify.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/updater/notify.coffee | 1 | 15 |
lucasmotta/dploy:src/ftp.coffee:1:raw_corpus | raw_corpus | module.exports = class FTP
connection : null
connected : null
failed : null
closed : null
constructor: ->
@connected = new Signal()
@failed = new Signal()
@closed = new Signal()
# Create a new instance of the FTP
@connection = new ftp()
@connection.on "error", => @failed.dispatch()
@connectio... | CoffeeScript | lucasmotta/dploy | src/ftp.coffee | MIT | 1ccd503ddca9d7586e7fc498366aa518e2b32cb3 | 973 | https://github.com/lucasmotta/dploy/blob/1ccd503ddca9d7586e7fc498366aa518e2b32cb3/src/ftp.coffee | 4 | 53 | ||
lucasmotta/dploy:src/ftp.coffee:1:completion | completion | module.exports = class FTP
connection : null
connected : null
failed : null
closed : null
constructor: ->
@connected = new Signal()
@failed = new Signal()
@closed = new Signal()
# Create a new instance of the FTP
@connection = new ftp()
@connection.on "error", => @failed.dispatch()
@connectio... | host : config.host
port : config.port
user : config.user
password : config.pass
###
Close the connection
###
close: (callback) ->
@connection.on "end", => @closed.dispatch()
@connection.end()
###
Dispose
###
dispose: ->
if @connected
@connected.dispose()
@connected = null
if @failed... | CoffeeScript | CoffeeScript | lucasmotta/dploy | src/ftp.coffee | MIT | 1ccd503ddca9d7586e7fc498366aa518e2b32cb3 | 973 | https://github.com/lucasmotta/dploy/blob/1ccd503ddca9d7586e7fc498366aa518e2b32cb3/src/ftp.coffee | 4 | 53 |
lucasmotta/dploy:src/ftp.coffee:2:raw_corpus | raw_corpus | @closed.dispose()
@closed = null
###
Retrieve a file on the server
@param path: <string> The path of your file
@param callback: <function> Callback method
###
get: (path, callback) ->
@connection.get path, callback
###
Upload a file to the server
@param local_path: <string> The local path of your file... | CoffeeScript | lucasmotta/dploy | src/ftp.coffee | MIT | 1ccd503ddca9d7586e7fc498366aa518e2b32cb3 | 973 | https://github.com/lucasmotta/dploy/blob/1ccd503ddca9d7586e7fc498366aa518e2b32cb3/src/ftp.coffee | 54 | 92 | ||
lucasmotta/dploy:src/ftp.coffee:2:completion | completion | @closed.dispose()
@closed = null
###
Retrieve a file on the server
@param path: <string> The path of your file
@param callback: <function> Callback method
###
get: (path, callback) ->
@connection.get path, callback
###
Upload a file to the server
@param local_path: <string> The local path of your file... | upload: (local_path, remote_path, callback) ->
@connection.put local_path, remote_path, callback
###
Delete a file from the server
@param remote_path: <string> The remote path you want to delete
@param callback: <function> Callback method
###
delete: (remote_path, callback) ->
@connection.delete remote_path... | CoffeeScript | CoffeeScript | lucasmotta/dploy | src/ftp.coffee | MIT | 1ccd503ddca9d7586e7fc498366aa518e2b32cb3 | 973 | https://github.com/lucasmotta/dploy/blob/1ccd503ddca9d7586e7fc498366aa518e2b32cb3/src/ftp.coffee | 54 | 92 |
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:raw_corpus | raw_corpus | NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'
# Represents a comment node
module.exports = class XMLComment extends XMLCharacterData
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super parent
if not text?
t... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLComment.coffee | 1 | 34 | ||
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'
# Represents a comment node
module.exports = class XMLComment extends XMLCharacterData
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (pa... | var NodeType, XMLCharacterData, XMLComment;
NodeType = require('./NodeType');
XMLCharacterData = require('./XMLCharacterData');
// Represents a comment node
module.exports = XMLComment = class XMLComment extends XMLCharacterData {
// Initializes a new instance of `XMLComment`
// `text` comment text
constructo... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLComment.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var NodeType, XMLCharacterData, XMLComment;
NodeType = require('./NodeType');
XMLCharacterData = require('./XMLCharacterData');
// Represents a comment node
module.exports = XMLComment = class XMLComment extends XMLCharacterData {
// Initializes a new instance... | NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'
# Represents a comment node
module.exports = class XMLComment extends XMLCharacterData
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super parent
if not text?
t... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLComment.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:completion | completion | NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'
# Represents a comment node
module.exports = class XMLComment extends XMLCharacterData
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super parent
if not text?
t... | @type = NodeType.Comment
@value = @stringify.comment text
# Creates and returns a deep clone of `this`
clone: () ->
Object.create @
# Converts the XML fragment to string
#
# `options.pretty` pretty prints the result
# `options.indent` indentation for pretty print
# `options.offset` how many in... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/XMLComment.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:raw_corpus | raw_corpus | XMLNode = require './XMLNode'
NodeType = require './NodeType'
# Represents a comment node
module.exports = class XMLComment extends XMLNode
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super parent
if not text?
throw new Error "Missing com... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | b3f243ffbeb47486162b212d976fe7e97918e6dc | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLComment.coffee | 1 | 34 | ||
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
XMLNode = require './XMLNode'
NodeType = require './NodeType'
# Represents a comment node
module.exports = class XMLComment extends XMLNode
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super pa... | var NodeType, XMLComment, XMLNode;
XMLNode = require('./XMLNode');
NodeType = require('./NodeType');
// Represents a comment node
module.exports = XMLComment = class XMLComment extends XMLNode {
// Initializes a new instance of `XMLComment`
// `text` comment text
constructor(parent, text) {
super(parent);... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | b3f243ffbeb47486162b212d976fe7e97918e6dc | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLComment.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var NodeType, XMLComment, XMLNode;
XMLNode = require('./XMLNode');
NodeType = require('./NodeType');
// Represents a comment node
module.exports = XMLComment = class XMLComment extends XMLNode {
// Initializes a new instance of `XMLComment`
// `text` commen... | XMLNode = require './XMLNode'
NodeType = require './NodeType'
# Represents a comment node
module.exports = class XMLComment extends XMLNode
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super parent
if not text?
throw new Error "Missing com... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | b3f243ffbeb47486162b212d976fe7e97918e6dc | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLComment.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:completion | completion | XMLNode = require './XMLNode'
NodeType = require './NodeType'
# Represents a comment node
module.exports = class XMLComment extends XMLNode
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super parent
if not text?
throw new Error "Missing com... | @type = NodeType.Comment
@value = @stringify.comment text
# Creates and returns a deep clone of `this`
clone: () ->
Object.create @
# Converts the XML fragment to string
#
# `options.pretty` pretty prints the result
# `options.indent` indentation for pretty print
# `options.offset` how many in... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | b3f243ffbeb47486162b212d976fe7e97918e6dc | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/b3f243ffbeb47486162b212d976fe7e97918e6dc/src/XMLComment.coffee | 1 | 34 |
oozcitak/xmlbuilder-js:src/XMLComment.coffee:1:raw_corpus | raw_corpus | XMLNode = require './XMLNode'
NodeType = require './NodeType'
# Represents a comment node
module.exports = class XMLComment extends XMLNode
# Initializes a new instance of `XMLComment`
#
# `text` comment text
constructor: (parent, text) ->
super parent
if not text?
throw new Error "Missing com... | CoffeeScript | oozcitak/xmlbuilder-js | src/XMLComment.coffee | MIT | c82ecdf27a636f7a0d2882fd51560d99211b0037 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/c82ecdf27a636f7a0d2882fd51560d99211b0037/src/XMLComment.coffee | 1 | 33 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.