id
stringlengths
34
124
type
stringclasses
4 values
prompt
stringlengths
0
4.95k
response
stringlengths
21
4.89k
source_lang
stringclasses
3 values
target_lang
stringclasses
2 values
repo
stringclasses
75 values
path
stringlengths
10
88
license
stringclasses
1 value
commit
stringlengths
40
40
stars
int64
431
18.7k
source_url
stringlengths
86
176
line_start
int64
1
214
line_end
int64
3
253
abe33/atom-pigments:lib/color-expression.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Color, ColorExpression, createVariableRegExpString; Color = require('./color'); ({createVariableRegExpString} = require('./regexes')); module.exports = ColorExpression = class ColorExpression { static colorExpressionForContext(context) { return this.co...
Color = require './color' {createVariableRegExpString} = require './regexes' module.exports = class ColorExpression @colorExpressionForContext: (context) -> @colorExpressionForColorVariables(context.getColorVariables()) @colorExpressionForColorVariables: (colorVariables) -> paletteRegexpString = createVar...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
10dd02cd2aff39c8bc995d9d5914c9b0b2007048
518
https://github.com/abe33/atom-pigments/blob/10dd02cd2aff39c8bc995d9d5914c9b0b2007048/lib/color-expression.coffee
1
50
abe33/atom-pigments:lib/color-expression.coffee:1:completion
completion
Color = require './color' {createVariableRegExpString} = require './regexes' module.exports = class ColorExpression @colorExpressionForContext: (context) -> @colorExpressionForColorVariables(context.getColorVariables()) @colorExpressionForColorVariables: (colorVariables) -> paletteRegexpString = createVar...
@rgba = baseColor.rgba constructor: ({@name, @regexpString, @handle}) -> @regexp = new RegExp("^#{@regexpString}$") match: (expression) -> @regexp.test expression parse: (expression, context) -> return null unless @match(expression) color = new Color() color.colorExpression = expression @h...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
10dd02cd2aff39c8bc995d9d5914c9b0b2007048
518
https://github.com/abe33/atom-pigments/blob/10dd02cd2aff39c8bc995d9d5914c9b0b2007048/lib/color-expression.coffee
1
50
abe33/atom-pigments:lib/color-expression.coffee:1:raw_corpus
raw_corpus
Color = require './color' {createVariableRegExpString} = require './regexes' module.exports = class ColorExpression @colorExpressionForContext: (context) -> @colorExpressionForColorVariables(context.getColorVariables()) @colorExpressionForColorVariables: (colorVariables) -> paletteRegexpString = createVar...
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
85cec032e06bb0e06b45873652cd0627c90189d7
518
https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-expression.coffee
1
49
abe33/atom-pigments:lib/color-expression.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Color = require './color' {createVariableRegExpString} = require './regexes' module.exports = class ColorExpression @colorExpressionForContext: (context) -> @colorExpressionForColorVariables(context.getColorVariables()) @colorExpressionForColorVariables...
var Color, ColorExpression, createVariableRegExpString; Color = require('./color'); ({createVariableRegExpString} = require('./regexes')); module.exports = ColorExpression = class ColorExpression { static colorExpressionForContext(context) { return this.colorExpressionForColorVariables(context.getColorVariable...
CoffeeScript
JavaScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
85cec032e06bb0e06b45873652cd0627c90189d7
518
https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-expression.coffee
1
49
abe33/atom-pigments:lib/color-expression.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Color, ColorExpression, createVariableRegExpString; Color = require('./color'); ({createVariableRegExpString} = require('./regexes')); module.exports = ColorExpression = class ColorExpression { static colorExpressionForContext(context) { return this.co...
Color = require './color' {createVariableRegExpString} = require './regexes' module.exports = class ColorExpression @colorExpressionForContext: (context) -> @colorExpressionForColorVariables(context.getColorVariables()) @colorExpressionForColorVariables: (colorVariables) -> paletteRegexpString = createVar...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
85cec032e06bb0e06b45873652cd0627c90189d7
518
https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-expression.coffee
1
49
abe33/atom-pigments:lib/color-expression.coffee:1:completion
completion
Color = require './color' {createVariableRegExpString} = require './regexes' module.exports = class ColorExpression @colorExpressionForContext: (context) -> @colorExpressionForColorVariables(context.getColorVariables()) @colorExpressionForColorVariables: (colorVariables) -> paletteRegexpString = createVar...
constructor: ({@name, @regexpString, @handle}) -> @regexp = new RegExp("^#{@regexpString}$") match: (expression) -> @regexp.test expression parse: (expression, context) -> return null unless @match(expression) color = new Color() color.colorExpression = expression @handle.call(color, @regexp....
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
85cec032e06bb0e06b45873652cd0627c90189d7
518
https://github.com/abe33/atom-pigments/blob/85cec032e06bb0e06b45873652cd0627c90189d7/lib/color-expression.coffee
1
49
abe33/atom-pigments:lib/color-expression.coffee:1:raw_corpus
raw_corpus
Color = require './color' module.exports = class ColorExpression constructor: ({@name, @regexpString, @handle}) -> @regexp = new RegExp("^#{@regexpString}$") match: (expression) -> @regexp.test expression parse: (expression, context) -> return null unless @match(expression) color = new Color() ...
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-expression.coffee
1
29
abe33/atom-pigments:lib/color-expression.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript Color = require './color' module.exports = class ColorExpression constructor: ({@name, @regexpString, @handle}) -> @regexp = new RegExp("^#{@regexpString}$") match: (expression) -> @regexp.test expression parse: (expression, context) -> return nu...
var Color, ColorExpression; Color = require('./color'); module.exports = ColorExpression = class ColorExpression { constructor({name, regexpString, handle}) { this.name = name; this.regexpString = regexpString; this.handle = handle; this.regexp = new RegExp(`^${this.regexpString}$`); } match(ex...
CoffeeScript
JavaScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-expression.coffee
1
29
abe33/atom-pigments:lib/color-expression.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Color, ColorExpression; Color = require('./color'); module.exports = ColorExpression = class ColorExpression { constructor({name, regexpString, handle}) { this.name = name; this.regexpString = regexpString; this.handle = handle; this.regexp ...
Color = require './color' module.exports = class ColorExpression constructor: ({@name, @regexpString, @handle}) -> @regexp = new RegExp("^#{@regexpString}$") match: (expression) -> @regexp.test expression parse: (expression, context) -> return null unless @match(expression) color = new Color() ...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-expression.coffee
1
29
abe33/atom-pigments:lib/color-expression.coffee:1:completion
completion
Color = require './color' module.exports = class ColorExpression constructor: ({@name, @regexpString, @handle}) -> @regexp = new RegExp("^#{@regexpString}$") match: (expression) -> @regexp.test expression parse: (expression, context) -> return null unless @match(expression) color = new Color() ...
@handle.call(color, @regexp.exec(expression), expression, context) color search: (text, start=0) -> results = undefined re = new RegExp(@regexpString, 'g') re.lastIndex = start if [match] = re.exec(text) {lastIndex} = re range = [lastIndex - match.length, lastIndex] results = ...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-expression.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-expression.coffee
1
29
jnordberg/wintersmith:src/cli/plugin.coffee:1:raw_corpus
raw_corpus
max = (array, get) -> get ?= (item) -> item rv = null for item in array v = get(item) rv = v if v > rv return rv
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
33
39
jnordberg/wintersmith:src/cli/plugin.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript max = (array, get) -> get ?= (item) -> item rv = null for item in array v = get(item) rv = v if v > rv return rv ```
var max; max = function(array, get) { var i, item, len, rv, v; if (get == null) { get = function(item) { return item; }; } rv = null; for (i = 0, len = array.length; i < len; i++) { item = array[i]; v = get(item); if (v > rv) { rv = v; } } return rv; };
CoffeeScript
JavaScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
33
39
jnordberg/wintersmith:src/cli/plugin.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var max; max = function(array, get) { var i, item, len, rv, v; if (get == null) { get = function(item) { return item; }; } rv = null; for (i = 0, len = array.length; i < len; i++) { item = array[i]; v = get(item); if (v > rv) { ...
max = (array, get) -> get ?= (item) -> item rv = null for item in array v = get(item) rv = v if v > rv return rv
JavaScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
33
39
jnordberg/wintersmith:src/cli/plugin.coffee:1:completion
completion
max = (array, get) -> get ?= (item) -> item rv = null
for item in array v = get(item) rv = v if v > rv return rv
CoffeeScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
33
39
jnordberg/wintersmith:src/cli/plugin.coffee:2:raw_corpus
raw_corpus
lpad = (string, amount, char=' ') -> p = '' p += char for i in [0...amount-string.length] return p + string
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
41
44
jnordberg/wintersmith:src/cli/plugin.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript lpad = (string, amount, char=' ') -> p = '' p += char for i in [0...amount-string.length] return p + string ```
var lpad; lpad = function(string, amount, char = ' ') { var i, j, p, ref; p = ''; for (i = j = 0, ref = amount - string.length; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) { p += char; } return p + string; };
CoffeeScript
JavaScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
41
44
jnordberg/wintersmith:src/cli/plugin.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var lpad; lpad = function(string, amount, char = ' ') { var i, j, p, ref; p = ''; for (i = j = 0, ref = amount - string.length; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) { p += char; } return p + string; }; ```
lpad = (string, amount, char=' ') -> p = '' p += char for i in [0...amount-string.length] return p + string
JavaScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
41
44
jnordberg/wintersmith:src/cli/plugin.coffee:2:completion
completion
lpad = (string, amount, char=' ') -> p = ''
p += char for i in [0...amount-string.length] return p + string
CoffeeScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
41
44
jnordberg/wintersmith:src/cli/plugin.coffee:3:raw_corpus
raw_corpus
clip = (string, maxlen) -> return string if string.length <= maxlen return string[0...maxlen-2].trim() + ".."
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
46
48
jnordberg/wintersmith:src/cli/plugin.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript clip = (string, maxlen) -> return string if string.length <= maxlen return string[0...maxlen-2].trim() + ".." ```
var clip; clip = function(string, maxlen) { if (string.length <= maxlen) { return string; } return string.slice(0, maxlen - 2).trim() + ".."; };
CoffeeScript
JavaScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
46
48
jnordberg/wintersmith:src/cli/plugin.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var clip; clip = function(string, maxlen) { if (string.length <= maxlen) { return string; } return string.slice(0, maxlen - 2).trim() + ".."; }; ```
clip = (string, maxlen) -> return string if string.length <= maxlen return string[0...maxlen-2].trim() + ".."
JavaScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
46
48
jnordberg/wintersmith:src/cli/plugin.coffee:4:raw_corpus
raw_corpus
fetchListing = (callback) -> request = https.get 'https://api.npms.io/v2/search?q=keywords:wintersmith-plugin&size=200', (response) -> if response.statusCode isnt 200 error = new Error "Unexpected response when searching registry, HTTP #{ response.statusCode }" if not /^application\/json/.test response....
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
50
73
jnordberg/wintersmith:src/cli/plugin.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript fetchListing = (callback) -> request = https.get 'https://api.npms.io/v2/search?q=keywords:wintersmith-plugin&size=200', (response) -> if response.statusCode isnt 200 error = new Error "Unexpected response when searching registry, HTTP #{ response.sta...
var fetchListing; fetchListing = function(callback) { var request; return request = https.get('https://api.npms.io/v2/search?q=keywords:wintersmith-plugin&size=200', function(response) { var data, error; if (response.statusCode !== 200) { error = new Error(`Unexpected response when searching registry...
CoffeeScript
JavaScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
50
73
jnordberg/wintersmith:src/cli/plugin.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var fetchListing; fetchListing = function(callback) { var request; return request = https.get('https://api.npms.io/v2/search?q=keywords:wintersmith-plugin&size=200', function(response) { var data, error; if (response.statusCode !== 200) { error =...
fetchListing = (callback) -> request = https.get 'https://api.npms.io/v2/search?q=keywords:wintersmith-plugin&size=200', (response) -> if response.statusCode isnt 200 error = new Error "Unexpected response when searching registry, HTTP #{ response.statusCode }" if not /^application\/json/.test response....
JavaScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
50
73
jnordberg/wintersmith:src/cli/plugin.coffee:4:completion
completion
fetchListing = (callback) -> request = https.get 'https://api.npms.io/v2/search?q=keywords:wintersmith-plugin&size=200', (response) -> if response.statusCode isnt 200 error = new Error "Unexpected response when searching registry, HTTP #{ response.statusCode }" if not /^application\/json/.test response....
response.on 'end', -> try parsed = JSON.parse Buffer.concat data catch error callback error return listing = parsed.results.map (result) -> result.package listing.sort (a, b) -> return 1 if a.name > b.name return -1 if a.name < b.name return 0 ...
CoffeeScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
50
73
jnordberg/wintersmith:src/cli/plugin.coffee:5:raw_corpus
raw_corpus
displayListing = (list, callback) -> display = list.map (plugin) -> name = normalizePluginName plugin.name description = plugin.description maintainers = plugin.maintainers.map((v) -> v.username).join(' ') homepage = plugin.links?.homepage ? plugin.links?.npm return {name, description, maintainers...
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
75
97
jnordberg/wintersmith:src/cli/plugin.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript displayListing = (list, callback) -> display = list.map (plugin) -> name = normalizePluginName plugin.name description = plugin.description maintainers = plugin.maintainers.map((v) -> v.username).join(' ') homepage = plugin.links?.homepage ? plu...
var displayListing; displayListing = function(list, callback) { var display, i, left, len, line, margin, maxw, pad, plugin; display = list.map(function(plugin) { var description, homepage, maintainers, name, ref, ref1, ref2; name = normalizePluginName(plugin.name); description = plugin.description; ...
CoffeeScript
JavaScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
75
97
jnordberg/wintersmith:src/cli/plugin.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var displayListing; displayListing = function(list, callback) { var display, i, left, len, line, margin, maxw, pad, plugin; display = list.map(function(plugin) { var description, homepage, maintainers, name, ref, ref1, ref2; name = normalizePluginName(...
displayListing = (list, callback) -> display = list.map (plugin) -> name = normalizePluginName plugin.name description = plugin.description maintainers = plugin.maintainers.map((v) -> v.username).join(' ') homepage = plugin.links?.homepage ? plugin.links?.npm return {name, description, maintainers...
JavaScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
75
97
jnordberg/wintersmith:src/cli/plugin.coffee:5:completion
completion
displayListing = (list, callback) -> display = list.map (plugin) -> name = normalizePluginName plugin.name description = plugin.description maintainers = plugin.maintainers.map((v) -> v.username).join(' ') homepage = plugin.links?.homepage ? plugin.links?.npm return {name, description, maintainers...
for plugin in display line = "#{ lpad(plugin.name, pad) } #{ clip(plugin.description, maxw - pad - 2) }" left = maxw - line.length if left > plugin.maintainers.length line += chalk.grey lpad(plugin.maintainers, left) logger.info line.replace /^\s*(\S+) /, (m) -> chalk.bold m if plugin.homepa...
CoffeeScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
75
97
jnordberg/wintersmith:src/cli/plugin.coffee:6:raw_corpus
raw_corpus
waterfall = (flow, callback) -> ### async.waterfall that allows for parallel tasks ### resolved = [] for item in flow switch typeof item when 'function' resolved.push item when 'object', 'array' resolved.push async.apply async.parallel, item else return callback new E...
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
99
110
jnordberg/wintersmith:src/cli/plugin.coffee:6:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript waterfall = (flow, callback) -> ### async.waterfall that allows for parallel tasks ### resolved = [] for item in flow switch typeof item when 'function' resolved.push item when 'object', 'array' resolved.push async.apply asyn...
var waterfall; waterfall = function(flow, callback) { /* async.waterfall that allows for parallel tasks */ var i, item, len, resolved; resolved = []; for (i = 0, len = flow.length; i < len; i++) { item = flow[i]; switch (typeof item) { case 'function': resolved.push(item); break; ...
CoffeeScript
JavaScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
99
110
jnordberg/wintersmith:src/cli/plugin.coffee:6:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var waterfall; waterfall = function(flow, callback) { /* async.waterfall that allows for parallel tasks */ var i, item, len, resolved; resolved = []; for (i = 0, len = flow.length; i < len; i++) { item = flow[i]; switch (typeof item) { case '...
waterfall = (flow, callback) -> ### async.waterfall that allows for parallel tasks ### resolved = [] for item in flow switch typeof item when 'function' resolved.push item when 'object', 'array' resolved.push async.apply async.parallel, item else return callback new E...
JavaScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
99
110
jnordberg/wintersmith:src/cli/plugin.coffee:6:completion
completion
waterfall = (flow, callback) -> ### async.waterfall that allows for parallel tasks ### resolved = [] for item in flow switch typeof item when 'function'
resolved.push item when 'object', 'array' resolved.push async.apply async.parallel, item else return callback new Error "Invalid item '#{ item }' in flow" async.waterfall resolved, callback
CoffeeScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
99
110
jnordberg/wintersmith:src/cli/plugin.coffee:8:raw_corpus
raw_corpus
main = (argv) -> action = argv._[3] if not action? console.log usage process.exit 0 loadCurrentEnv = (callback) -> loadEnv argv, callback installPlugin = (res, callback) -> [env, list] = res name = argv._[4] plugin = null for p in list if normalizePluginName(p.name) is nor...
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
115
164
jnordberg/wintersmith:src/cli/plugin.coffee:8:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript main = (argv) -> action = argv._[3] if not action? console.log usage process.exit 0 loadCurrentEnv = (callback) -> loadEnv argv, callback installPlugin = (res, callback) -> [env, list] = res name = argv._[4] plugin = null ...
var main, indexOf = [].indexOf; main = function(argv) { var action, installPlugin, loadCurrentEnv; action = argv._[3]; if (action == null) { console.log(usage); process.exit(0); } loadCurrentEnv = function(callback) { return loadEnv(argv, callback); }; return installPlugin = function(res, c...
CoffeeScript
JavaScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
115
164
jnordberg/wintersmith:src/cli/plugin.coffee:8:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var main, indexOf = [].indexOf; main = function(argv) { var action, installPlugin, loadCurrentEnv; action = argv._[3]; if (action == null) { console.log(usage); process.exit(0); } loadCurrentEnv = function(callback) { return loadEnv(argv, c...
main = (argv) -> action = argv._[3] if not action? console.log usage process.exit 0 loadCurrentEnv = (callback) -> loadEnv argv, callback installPlugin = (res, callback) -> [env, list] = res name = argv._[4] plugin = null for p in list if normalizePluginName(p.name) is nor...
JavaScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
115
164
jnordberg/wintersmith:src/cli/plugin.coffee:8:completion
completion
main = (argv) -> action = argv._[3] if not action? console.log usage process.exit 0 loadCurrentEnv = (callback) -> loadEnv argv, callback installPlugin = (res, callback) -> [env, list] = res name = argv._[4] plugin = null for p in list if normalizePluginName(p.name) is nor...
packageFile = env.resolvePath 'package.json' createPackageJson = (callback) -> fileExists packageFile, (exists) -> if exists callback() else logger.warn "package.json missing, creating minimal package" fs.writeFile packageFile, '{\n "dependencies": {},\n "priva...
CoffeeScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
115
164
jnordberg/wintersmith:src/cli/plugin.coffee:9:raw_corpus
raw_corpus
logger.verbose "installing #{ plugin.name }" process.chdir env.workDir async.series [ createPackageJson (callback) -> npm.load {logstream: new NpmAdapter(logger), save: true}, callback (callback) -> npm.install plugin.name, callback ], (error) -> callback error async.water...
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
165
189
jnordberg/wintersmith:src/cli/plugin.coffee:9:completion
completion
logger.verbose "installing #{ plugin.name }" process.chdir env.workDir async.series [ createPackageJson (callback) -> npm.load {logstream: new NpmAdapter(logger), save: true}, callback (callback) -> npm.install plugin.name, callback ], (error) -> callback error async.water...
cmd = [fetchListing, displayListing] when 'install' cmd = [[loadCurrentEnv, fetchListing], installPlugin] else cmd = [(callback) -> callback new Error "Unknown plugin action: #{ action }"] waterfall cmd, (error) -> if error? logger.error error.message, error process.exit 1 el...
CoffeeScript
CoffeeScript
jnordberg/wintersmith
src/cli/plugin.coffee
MIT
be757f5f7d72ddce462f67913c9cd7c578162018
3,484
https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/plugin.coffee
165
189
jianliaoim/talk-os:talk-web/client/util/constraint.coffee:1:raw_corpus
raw_corpus
exports.image = (imageHeight, imageWidth, min, max) -> if imageWidth > max if imageHeight < min height = min width = max else if (imageHeight / imageWidth) > 1 height = max width = imageWidth / (imageHeight / max) else height = imageHeight / (imageWidth / max) width = m...
CoffeeScript
jianliaoim/talk-os
talk-web/client/util/constraint.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/constraint.coffee
1
33
jianliaoim/talk-os:talk-web/client/util/constraint.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript exports.image = (imageHeight, imageWidth, min, max) -> if imageWidth > max if imageHeight < min height = min width = max else if (imageHeight / imageWidth) > 1 height = max width = imageWidth / (imageHeight / max) else ...
exports.image = function(imageHeight, imageWidth, min, max) { var height, width; if (imageWidth > max) { if (imageHeight < min) { height = min; width = max; } else if ((imageHeight / imageWidth) > 1) { height = max; width = imageWidth / (imageHeight / max); } else { height ...
CoffeeScript
JavaScript
jianliaoim/talk-os
talk-web/client/util/constraint.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/constraint.coffee
1
33
jianliaoim/talk-os:talk-web/client/util/constraint.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript exports.image = function(imageHeight, imageWidth, min, max) { var height, width; if (imageWidth > max) { if (imageHeight < min) { height = min; width = max; } else if ((imageHeight / imageWidth) > 1) { height = max; width = image...
exports.image = (imageHeight, imageWidth, min, max) -> if imageWidth > max if imageHeight < min height = min width = max else if (imageHeight / imageWidth) > 1 height = max width = imageWidth / (imageHeight / max) else height = imageHeight / (imageWidth / max) width = m...
JavaScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/util/constraint.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/constraint.coffee
1
33
jianliaoim/talk-os:talk-web/client/util/constraint.coffee:1:completion
completion
exports.image = (imageHeight, imageWidth, min, max) -> if imageWidth > max if imageHeight < min height = min width = max else if (imageHeight / imageWidth) > 1 height = max width = imageWidth / (imageHeight / max) else height = imageHeight / (imageWidth / max) width = m...
height = imageHeight / (imageWidth / max) width = max else height = max width = imageWidth / (imageWidth / max) height = Math.round height or imageHeight width = Math.round width or imageWidth { height, width } exports.thumbnail = (thumbnailUrl, height, width) -> if thumbnailUrl?.length...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/util/constraint.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/util/constraint.coffee
1
33
gss/engine:src/concepts/Type.coffee:1:raw_corpus
raw_corpus
class Type @define: (property, value)-> if value @[property] = value else for prop, value of property @define prop, value Type.define # Decimal value (e.g. line-height: 1.0) Float: (obj) -> parsed = parseFloat(obj) if parsed == obj return parsed # Integer value (e.g....
CoffeeScript
gss/engine
src/concepts/Type.coffee
MIT
52c9369320bcc6e770a56d6de90833bebaed3156
2,854
https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/concepts/Type.coffee
1
50
gss/engine:src/concepts/Type.coffee:1:completion
completion
class Type @define: (property, value)-> if value @[property] = value else for prop, value of property @define prop, value Type.define # Decimal value (e.g. line-height: 1.0) Float: (obj) -> parsed = parseFloat(obj) if parsed == obj return parsed # Integer value (e.g....
return obj # Array of strings (e.g. font-family) Strings: (obj) -> if typeof obj == 'string' || obj instanceof Array return obj Timings: 'ease': ['cubic-bezier', .42, 0, 1, 1] 'ease-in': ['cubic-bezier', .42, 0, 1, 1] 'ease-out': ['cubic-bezier', 0, 0, .58, 1] 'ease...
CoffeeScript
CoffeeScript
gss/engine
src/concepts/Type.coffee
MIT
52c9369320bcc6e770a56d6de90833bebaed3156
2,854
https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/concepts/Type.coffee
1
50
gss/engine:src/concepts/Type.coffee:2:raw_corpus
raw_corpus
return obj if @Unit[obj[0]] if obj[1] == 0 return 0 return obj # Length with % unit Percentage: (obj) -> if obj[0] == '%' return obj # Keywords for background-position and alike Positions: {"top", "bottom", "left", "right"} Position: (obj) -> if @Type.Positions[obj] ...
CoffeeScript
gss/engine
src/concepts/Type.coffee
MIT
52c9369320bcc6e770a56d6de90833bebaed3156
2,854
https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/concepts/Type.coffee
51
100
gss/engine:src/concepts/Type.coffee:2:completion
completion
return obj if @Unit[obj[0]] if obj[1] == 0 return 0 return obj # Length with % unit Percentage: (obj) -> if obj[0] == '%' return obj # Keywords for background-position and alike Positions: {"top", "bottom", "left", "right"} Position: (obj) -> if @Type.Positions[obj] ...
Color: (obj) -> if typeof obj == 'string' if @Type.Pseudocolors[obj] return obj else if @Type.Colors[obj[0]] return obj Sizes: {'medium', 'xx-small', 'x-small', 'small', 'large', 'x-large', 'xx-large', 'smaller', 'larger' } Size: (obj) -> if @Type.Sizes[obj] return obj...
CoffeeScript
CoffeeScript
gss/engine
src/concepts/Type.coffee
MIT
52c9369320bcc6e770a56d6de90833bebaed3156
2,854
https://github.com/gss/engine/blob/52c9369320bcc6e770a56d6de90833bebaed3156/src/concepts/Type.coffee
51
100
abe33/atom-pigments:lib/color-context.coffee:2:raw_corpus
raw_corpus
class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @rootPaths ?= [] @referencePath ?= @referenceVariable.pat...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @roo...
var ColorContext; ColorContext = class ColorContext { constructor(options = {}) { var ColorParser, colorVariables, i, j, len, len1, ref, ref1, sorted, v, variables; this.sortPaths = this.sortPaths.bind(this); ({variables, colorVariables, referenceVariable: this.referenceVariable, referencePath: this.refe...
CoffeeScript
JavaScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var ColorContext; ColorContext = class ColorContext { constructor(options = {}) { var ColorParser, colorVariables, i, j, len, len1, ref, ref1, sorted, v, variables; this.sortPaths = this.sortPaths.bind(this); ({variables, colorVariables, referenceVar...
class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @rootPaths ?= [] @referencePath ?= @referenceVariable.pat...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:2:completion
completion
class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @rootPaths ?= [] @referencePath ?= @referenceVariable.pat...
@defaultVars[v.name] = v if v.path.match /\/.pigments$/ for v in @colorVariables @colorVars[v.name] = v @defaultColorVars[v.name] = v if v.path.match /\/.pigments$/ unless @parser? ColorParser = require './color-parser' @parser = new ColorParser @usedVariables = [] sortPa...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:3:raw_corpus
raw_corpus
0 else 0 rootPathForPath: (path) -> return root for root in @rootPaths when path.indexOf("#{root}/") is 0 clone: -> new ColorContext({ @variables @colorVariables @referenceVariable @parser @vars @colorVars @defaultVars @defaultColorVars sorte...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
56
105
abe33/atom-pigments:lib/color-context.coffee:3:completion
completion
0 else 0 rootPathForPath: (path) -> return root for root in @rootPaths when path.indexOf("#{root}/") is 0 clone: -> new ColorContext({ @variables @colorVariables @referenceVariable @parser @vars @colorVars @defaultVars @defaultColorVars sorte...
getVariables: -> @variables getColorVariables: -> @colorVariables getVariablesNames: -> @varNames ?= Object.keys(@vars) getVariablesCount: -> @varCount ?= @getVariablesNames().length getValue: (value) -> [realValue, lastRealValue] = [] while realValue = @vars[value]?.value @usedVariables.push...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
56
105
abe33/atom-pigments:lib/color-context.coffee:4:raw_corpus
raw_corpus
readUsedVariables: -> usedVariables = [] usedVariables.push v for v in @usedVariables when v not in usedVariables @usedVariables = [] usedVariables readColorExpression: (value) -> if @colorVars[value]? @usedVariables.push(value) @colorVars[value].value else value readColo...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
106
155
abe33/atom-pigments:lib/color-context.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript readUsedVariables: -> usedVariables = [] usedVariables.push v for v in @usedVariables when v not in usedVariables @usedVariables = [] usedVariables readColorExpression: (value) -> if @colorVars[value]? @usedVariables.push(value) ...
var indexOf = [].indexOf; ({ readUsedVariables: function() { var i, len, ref, usedVariables, v; usedVariables = []; ref = this.usedVariables; for (i = 0, len = ref.length; i < len; i++) { v = ref[i]; if (indexOf.call(usedVariables, v) < 0) { usedVariables.push(v); } } ...
CoffeeScript
JavaScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
106
155
abe33/atom-pigments:lib/color-context.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var indexOf = [].indexOf; ({ readUsedVariables: function() { var i, len, ref, usedVariables, v; usedVariables = []; ref = this.usedVariables; for (i = 0, len = ref.length; i < len; i++) { v = ref[i]; if (indexOf.call(usedVariables, v)...
readUsedVariables: -> usedVariables = [] usedVariables.push v for v in @usedVariables when v not in usedVariables @usedVariables = [] usedVariables readColorExpression: (value) -> if @colorVars[value]? @usedVariables.push(value) @colorVars[value].value else value readColo...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
106
155
abe33/atom-pigments:lib/color-context.coffee:4:completion
completion
readUsedVariables: -> usedVariables = [] usedVariables.push v for v in @usedVariables when v not in usedVariables @usedVariables = [] usedVariables readColorExpression: (value) -> if @colorVars[value]? @usedVariables.push(value) @colorVars[value].value else value readColo...
result = @readColor(@defaultColorVars[value].value) if result? and (keepAllVariables or value not in @usedVariables) result.variables = result.variables.concat(@readUsedVariables()) return result readFloat: (value) -> res = parseFloat(value) if isNaN(res) and @vars[value]? @usedVariabl...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
106
155
abe33/atom-pigments:lib/color-context.coffee:5:raw_corpus
raw_corpus
res = @readInt(@vars[value].value) if isNaN(res) and @defaultVars[value]? @usedVariables.push value res = @readInt(@defaultVars[value].value) res readPercent: (value) -> if not /\d+/.test(value) and @vars[value]? @usedVariables.push value value = @readPercent(@vars[value].value)...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
156
205
abe33/atom-pigments:lib/color-context.coffee:5:completion
completion
res = @readInt(@vars[value].value) if isNaN(res) and @defaultVars[value]? @usedVariables.push value res = @readInt(@defaultVars[value].value) res readPercent: (value) -> if not /\d+/.test(value) and @vars[value]? @usedVariables.push value value = @readPercent(@vars[value].value)...
if not /\d+/.test(value) and @defaultVars[value]? @usedVariables.push value value = @readIntOrPercent(@defaultVars[value].value) return NaN unless value? return value if typeof value is 'number' if value.indexOf('%') isnt -1 res = Math.round(parseFloat(value) * 2.55) else res =...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
156
205
abe33/atom-pigments:lib/color-context.coffee:6:raw_corpus
raw_corpus
if value.indexOf('%') isnt -1 res = parseFloat(value) / 100 else res = parseFloat(value) res = res / 100 if res > 1 res res
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
206
213
abe33/atom-pigments:lib/color-context.coffee:6:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript if value.indexOf('%') isnt -1 res = parseFloat(value) / 100 else res = parseFloat(value) res = res / 100 if res > 1 res res ```
var res; if (value.indexOf('%') !== -1) { res = parseFloat(value) / 100; } else { res = parseFloat(value); if (res > 1) { res = res / 100; } res; } res;
CoffeeScript
JavaScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
206
213
abe33/atom-pigments:lib/color-context.coffee:6:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var res; if (value.indexOf('%') !== -1) { res = parseFloat(value) / 100; } else { res = parseFloat(value); if (res > 1) { res = res / 100; } res; } res; ```
if value.indexOf('%') isnt -1 res = parseFloat(value) / 100 else res = parseFloat(value) res = res / 100 if res > 1 res res
JavaScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
206
213
abe33/atom-pigments:lib/color-context.coffee:6:completion
completion
if value.indexOf('%') isnt -1 res = parseFloat(value) / 100 else res = parseFloat(value)
res = res / 100 if res > 1 res res
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
4fe151a7c41894f39656b9b1c1166fcfd5d27c28
518
https://github.com/abe33/atom-pigments/blob/4fe151a7c41894f39656b9b1c1166fcfd5d27c28/lib/color-context.coffee
206
213
abe33/atom-pigments:lib/color-context.coffee:2:raw_corpus
raw_corpus
class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @rootPaths ?= [] @referencePath ?= @referenceVariable.pat...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @roo...
var ColorContext; ColorContext = class ColorContext { constructor(options = {}) { var ColorParser, colorVariables, i, j, len, len1, ref, ref1, sorted, v, variables; this.sortPaths = this.sortPaths.bind(this); ({variables, colorVariables, referenceVariable: this.referenceVariable, referencePath: this.refe...
CoffeeScript
JavaScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var ColorContext; ColorContext = class ColorContext { constructor(options = {}) { var ColorParser, colorVariables, i, j, len, len1, ref, ref1, sorted, v, variables; this.sortPaths = this.sortPaths.bind(this); ({variables, colorVariables, referenceVar...
class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @rootPaths ?= [] @referencePath ?= @referenceVariable.pat...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:2:completion
completion
class ColorContext constructor: (options={}) -> {variables, colorVariables, @referenceVariable, @referencePath, @rootPaths, @parser, @colorVars, @vars, @defaultVars, @defaultColorVars, sorted} = options variables ?= [] colorVariables ?= [] @rootPaths ?= [] @referencePath ?= @referenceVariable.pat...
for v in @colorVariables @colorVars[v.name] = v @defaultColorVars[v.name] = v if v.path.match /\/.pigments$/ unless @parser? ColorParser = require './color-parser' @parser = new ColorParser @usedVariables = [] sortPaths: (a,b) => if @referencePath? return 0 if a.path i...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
6
55
abe33/atom-pigments:lib/color-context.coffee:3:raw_corpus
raw_corpus
else 0 rootPathForPath: (path) -> return root for root in @rootPaths when path.indexOf("#{root}/") is 0 clone: -> new ColorContext({ @variables @colorVariables @referenceVariable @parser @vars @colorVars @defaultVars @defaultColorVars sorted: tru...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
56
105
abe33/atom-pigments:lib/color-context.coffee:3:completion
completion
else 0 rootPathForPath: (path) -> return root for root in @rootPaths when path.indexOf("#{root}/") is 0 clone: -> new ColorContext({ @variables @colorVariables @referenceVariable @parser @vars @colorVars @defaultVars @defaultColorVars sorted: tru...
getColorVariables: -> @colorVariables getVariablesNames: -> @varNames ?= Object.keys(@vars) getVariablesCount: -> @varCount ?= @getVariablesNames().length getValue: (value) -> [realValue, lastRealValue] = [] while realValue = @vars[value]?.value @usedVariables.push(value) value = lastRealV...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
56
105
abe33/atom-pigments:lib/color-context.coffee:4:raw_corpus
raw_corpus
usedVariables = [] usedVariables.push v for v in @usedVariables when v not in usedVariables @usedVariables = [] usedVariables readColorExpression: (value) -> if @colorVars[value]? @usedVariables.push(value) @colorVars[value].value else value readColor: (value, keepAllVariable...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
106
155
abe33/atom-pigments:lib/color-context.coffee:4:completion
completion
usedVariables = [] usedVariables.push v for v in @usedVariables when v not in usedVariables @usedVariables = [] usedVariables readColorExpression: (value) -> if @colorVars[value]? @usedVariables.push(value) @colorVars[value].value else value readColor: (value, keepAllVariable...
if result? and (keepAllVariables or value not in @usedVariables) result.variables = result.variables.concat(@readUsedVariables()) return result readFloat: (value) -> res = parseFloat(value) if isNaN(res) and @vars[value]? @usedVariables.push value res = @readFloat(@vars[value].value) ...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
106
155
abe33/atom-pigments:lib/color-context.coffee:5:raw_corpus
raw_corpus
if isNaN(res) and @defaultVars[value]? @usedVariables.push value res = @readInt(@defaultVars[value].value) res readPercent: (value) -> if not /\d+/.test(value) and @vars[value]? @usedVariables.push value value = @readPercent(@vars[value].value) if not /\d+/.test(value) and @defa...
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
156
205
abe33/atom-pigments:lib/color-context.coffee:5:completion
completion
if isNaN(res) and @defaultVars[value]? @usedVariables.push value res = @readInt(@defaultVars[value].value) res readPercent: (value) -> if not /\d+/.test(value) and @vars[value]? @usedVariables.push value value = @readPercent(@vars[value].value) if not /\d+/.test(value) and @defa...
value = @readIntOrPercent(@defaultVars[value].value) return NaN unless value? return value if typeof value is 'number' if value.indexOf('%') isnt -1 res = Math.round(parseFloat(value) * 2.55) else res = parseInt(value) res readFloatOrPercent: (value) -> if not /\d+/.test(value)...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
156
205
abe33/atom-pigments:lib/color-context.coffee:6:raw_corpus
raw_corpus
res = parseFloat(value) / 100 else res = parseFloat(value) res = res / 100 if res > 1 res res
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
206
212
abe33/atom-pigments:lib/color-context.coffee:6:completion
completion
res = parseFloat(value) / 100 else res = parseFloat(value)
res = res / 100 if res > 1 res res
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/color-context.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/color-context.coffee
206
212
technoweenie/coffee-resque:src/index.coffee:1:raw_corpus
raw_corpus
class Connection extends EventEmitter constructor: (options) -> @redis = options.redis || connectToRedis options @namespace = options.namespace || 'resque' @callbacks = options.callbacks || {} @timeout = options.timeout || 100 @redis.select options.database if options.database? # Pu...
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
3
29
technoweenie/coffee-resque:src/index.coffee:1:completion
completion
class Connection extends EventEmitter constructor: (options) -> @redis = options.redis || connectToRedis options @namespace = options.namespace || 'resque' @callbacks = options.callbacks || {} @timeout = options.timeout || 100 @redis.select options.database if options.database? # Pu...
# Public worker: (queues, options) -> options ||= {} options.callbacks ||= @callbacks new exports.Worker @, queues, options # Public end: -> @redis.quit() key: (args...) -> args.unshift @namespace args.join ":"
CoffeeScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
3
29
technoweenie/coffee-resque:src/index.coffee:2:raw_corpus
raw_corpus
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
31
80
technoweenie/coffee-resque:src/index.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} ...
var Worker; Worker = class Worker { constructor(connection, queues, options) { this.conn = connection; this.redis = connection.redis; this.queues = queues; this.name = [options.name || 'node', process.pid, queues].join(":"); this.callbacks = options.callbacks || {}; this.running = false; ...
CoffeeScript
JavaScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
31
80
technoweenie/coffee-resque:src/index.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Worker; Worker = class Worker { constructor(connection, queues, options) { this.conn = connection; this.redis = connection.redis; this.queues = queues; this.name = [options.name || 'node', process.pid, queues].join(":"); this.callbacks = ...
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
JavaScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
31
80
technoweenie/coffee-resque:src/index.coffee:2:completion
completion
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
poll: -> return if !@running @queue = @queues.shift() @queues.push @queue @conn.emit 'poll', @, @queue @redis.lpop @conn.key('queue', @queue), (err, resp) => if !err && resp @perform JSON.parse(resp.toString()) else @conn.emit err, @, @queue if err @pause() per...
CoffeeScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
31
80
technoweenie/coffee-resque:src/index.coffee:3:raw_corpus
raw_corpus
succeed: (job) -> @redis.incr @conn.key('stat', 'processed') @redis.incr @conn.key('stat', 'processed', @name) @conn.emit 'success', @, @queue, job fail: (err, job) -> @redis.incr @conn.key('stat', 'failed') @redis.incr @conn.key('stat', 'failed', @name) @redis.rpush @conn.key('failed'), ...
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
81
124
technoweenie/coffee-resque:src/index.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript succeed: (job) -> @redis.incr @conn.key('stat', 'processed') @redis.incr @conn.key('stat', 'processed', @name) @conn.emit 'success', @, @queue, job fail: (err, job) -> @redis.incr @conn.key('stat', 'failed') @redis.incr @conn.key('stat', ...
({ succeed: function(job) { this.redis.incr(this.conn.key('stat', 'processed')); this.redis.incr(this.conn.key('stat', 'processed', this.name)); return this.conn.emit('success', this, this.queue, job); }, fail: function(err, job) { this.redis.incr(this.conn.key('stat', 'failed')); this.redis.i...
CoffeeScript
JavaScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
81
124
technoweenie/coffee-resque:src/index.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript ({ succeed: function(job) { this.redis.incr(this.conn.key('stat', 'processed')); this.redis.incr(this.conn.key('stat', 'processed', this.name)); return this.conn.emit('success', this, this.queue, job); }, fail: function(err, job) { this.redis....
succeed: (job) -> @redis.incr @conn.key('stat', 'processed') @redis.incr @conn.key('stat', 'processed', @name) @conn.emit 'success', @, @queue, job fail: (err, job) -> @redis.incr @conn.key('stat', 'failed') @redis.incr @conn.key('stat', 'failed', @name) @redis.rpush @conn.key('failed'), ...
JavaScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
81
124
technoweenie/coffee-resque:src/index.coffee:3:completion
completion
succeed: (job) -> @redis.incr @conn.key('stat', 'processed') @redis.incr @conn.key('stat', 'processed', @name) @conn.emit 'success', @, @queue, job fail: (err, job) -> @redis.incr @conn.key('stat', 'failed') @redis.incr @conn.key('stat', 'failed', @name) @redis.rpush @conn.key('failed'), ...
@redis.sadd @conn.key('workers'), @name untrack: -> @redis.srem @conn.key('workers'), @name init: -> @track() @redis.set @conn.key('worker', @name, 'started'), (new Date).toString() checkQueues: -> return if @queues.shift? @queues = @queues.split(',') failurePayload: (err, job) -> {...
CoffeeScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
81
124
technoweenie/coffee-resque:src/index.coffee:4:raw_corpus
raw_corpus
connectToRedis = (options) -> require('../../node_redis').createClient options.port, options.host exports.Connection = Connection exports.Worker = Worker
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
126
130
technoweenie/coffee-resque:src/index.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript connectToRedis = (options) -> require('../../node_redis').createClient options.port, options.host exports.Connection = Connection exports.Worker = Worker ```
var connectToRedis; connectToRedis = function(options) { return require('../../node_redis').createClient(options.port, options.host); }; exports.Connection = Connection; exports.Worker = Worker;
CoffeeScript
JavaScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
126
130
technoweenie/coffee-resque:src/index.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var connectToRedis; connectToRedis = function(options) { return require('../../node_redis').createClient(options.port, options.host); }; exports.Connection = Connection; exports.Worker = Worker; ```
connectToRedis = (options) -> require('../../node_redis').createClient options.port, options.host exports.Connection = Connection exports.Worker = Worker
JavaScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
126
130
technoweenie/coffee-resque:src/index.coffee:4:completion
completion
connectToRedis = (options) -> require('../../node_redis').createClient options.port, options.host
exports.Connection = Connection exports.Worker = Worker
CoffeeScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
cbeb8f39ea2179bf2dda4a6c100b4ad08940b048
542
https://github.com/technoweenie/coffee-resque/blob/cbeb8f39ea2179bf2dda4a6c100b4ad08940b048/src/index.coffee
126
130
technoweenie/coffee-resque:src/index.coffee:1:raw_corpus
raw_corpus
class Connection extends EventEmitter constructor: (options) -> @redis = options.redis || connectToRedis options @namespace = options.namespace || 'resque' @callbacks = options.callbacks || {} @redis.select options.database if options.database? # Public enqueue: (queue, func, args...) -> ...
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
3
28
technoweenie/coffee-resque:src/index.coffee:1:completion
completion
class Connection extends EventEmitter constructor: (options) -> @redis = options.redis || connectToRedis options @namespace = options.namespace || 'resque' @callbacks = options.callbacks || {} @redis.select options.database if options.database? # Public enqueue: (queue, func, args...) -> ...
# Public worker: (queues, options) -> options ||= {} options.callbacks ||= @callbacks new exports.Worker @, queues, options # Public end: -> @redis.quit() key: (args...) -> args.unshift @namespace args.join ":"
CoffeeScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
3
28
technoweenie/coffee-resque:src/index.coffee:2:raw_corpus
raw_corpus
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
30
79
technoweenie/coffee-resque:src/index.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} ...
var Worker; Worker = class Worker { constructor(connection, queues, options) { this.conn = connection; this.redis = connection.redis; this.queues = queues; this.name = [options.name || 'node', process.pid, queues].join(":"); this.callbacks = options.callbacks || {}; this.running = false; ...
CoffeeScript
JavaScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
30
79
technoweenie/coffee-resque:src/index.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Worker; Worker = class Worker { constructor(connection, queues, options) { this.conn = connection; this.redis = connection.redis; this.queues = queues; this.name = [options.name || 'node', process.pid, queues].join(":"); this.callbacks = ...
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
JavaScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
30
79
technoweenie/coffee-resque:src/index.coffee:2:completion
completion
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
poll: -> return if !@running @queue = @queues.shift() @queues.push @queue @conn.emit 'poll', @, @queue @redis.lpop @conn.key('queue', @queue), (err, resp) => if resp @perform JSON.parse(resp.toString()) else @pause() perform: (job) -> @conn.emit 'job', @, @queue, j...
CoffeeScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
30
79
technoweenie/coffee-resque:src/index.coffee:3:raw_corpus
raw_corpus
@redis.incr @conn.key('stat', 'processed') @redis.incr @conn.key('stat', 'processed', @name) @conn.emit 'success', @, @queue, job fail: (err, job) -> @redis.incr @conn.key('stat', 'failed') @redis.incr @conn.key('stat', 'failed', @name) @redis.rpush @conn.key('failed'), JSON.stringify(@fa...
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
80
122
technoweenie/coffee-resque:src/index.coffee:3:completion
completion
@redis.incr @conn.key('stat', 'processed') @redis.incr @conn.key('stat', 'processed', @name) @conn.emit 'success', @, @queue, job fail: (err, job) -> @redis.incr @conn.key('stat', 'failed') @redis.incr @conn.key('stat', 'failed', @name) @redis.rpush @conn.key('failed'), JSON.stringify(@fa...
@redis.sadd @conn.key('workers'), @name untrack: -> @redis.srem @conn.key('workers'), @name init: -> @track() @redis.set @conn.key('worker', @name, 'started'), (new Date).toString() checkQueues: -> return if @queues.shift? @queues = @queues.split(',') failurePayload: (err, job) -> {...
CoffeeScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
e4292fd1dcccf0ab2cde485186f4151be883bc17
542
https://github.com/technoweenie/coffee-resque/blob/e4292fd1dcccf0ab2cde485186f4151be883bc17/src/index.coffee
80
122
technoweenie/coffee-resque:src/index.coffee:2:raw_corpus
raw_corpus
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
1738caa55676754bd2c6943a2134b6359aaec203
542
https://github.com/technoweenie/coffee-resque/blob/1738caa55676754bd2c6943a2134b6359aaec203/src/index.coffee
30
79
technoweenie/coffee-resque:src/index.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} ...
var Worker; Worker = class Worker { constructor(connection, queues, options) { this.conn = connection; this.redis = connection.redis; this.queues = queues; this.name = [options.name || 'node', process.pid, queues].join(":"); this.callbacks = options.callbacks || {}; this.running = false; ...
CoffeeScript
JavaScript
technoweenie/coffee-resque
src/index.coffee
MIT
1738caa55676754bd2c6943a2134b6359aaec203
542
https://github.com/technoweenie/coffee-resque/blob/1738caa55676754bd2c6943a2134b6359aaec203/src/index.coffee
30
79
technoweenie/coffee-resque:src/index.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Worker; Worker = class Worker { constructor(connection, queues, options) { this.conn = connection; this.redis = connection.redis; this.queues = queues; this.name = [options.name || 'node', process.pid, queues].join(":"); this.callbacks = ...
class Worker constructor: (connection, queues, options) -> @conn = connection @redis = connection.redis @queues = queues @name = [options.name || 'node', process.pid, queues].join(":") @callbacks = options.callbacks || {} @running = false @checkQueues() # Public sta...
JavaScript
CoffeeScript
technoweenie/coffee-resque
src/index.coffee
MIT
1738caa55676754bd2c6943a2134b6359aaec203
542
https://github.com/technoweenie/coffee-resque/blob/1738caa55676754bd2c6943a2134b6359aaec203/src/index.coffee
30
79