id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jashkenas/coffeescript:test/repl.coffee:3:raw_corpus | raw_corpus | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 22fb31e317022c5426ca8d8093410f95029130a3 | 16,577 | https://github.com/jashkenas/coffeescript/blob/22fb31e317022c5426ca8d8093410f95029130a3/test/repl.coffee | 38 | 87 | ||
jashkenas/coffeescript:test/repl.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl)... | var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, repl);
});
};
ctrlV = {
ctrl: true,
name: 'v'
};
t... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 22fb31e317022c5426ca8d8093410f95029130a3 | 16,577 | https://github.com/jashkenas/coffeescript/blob/22fb31e317022c5426ca8d8093410f95029130a3/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, rep... | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 22fb31e317022c5426ca8d8093410f95029130a3 | 16,577 | https://github.com/jashkenas/coffeescript/blob/22fb31e317022c5426ca8d8093410f95029130a3/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:3:completion | completion | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | input.emitLine '"1 + 1\\n"'
eq "'1 + 1\\n'", output.lastWrite()
testRepl "variables are saved", (input, output) ->
input.emitLine "foo = 'foo'"
input.emitLine 'foobar = "#{foo}bar"'
eq "'foobar'", output.lastWrite()
testRepl "empty command evaluates to undefined", (input, output) ->
# A regression fixed in ... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 22fb31e317022c5426ca8d8093410f95029130a3 | 16,577 | https://github.com/jashkenas/coffeescript/blob/22fb31e317022c5426ca8d8093410f95029130a3/test/repl.coffee | 38 | 87 |
jashkenas/coffeescript:test/repl.coffee:4:raw_corpus | raw_corpus | input.emitLine ''
eq '....... ', output.lastWrite(0)
testRepl "evaluates multiline", (input, output) ->
# Stubs. Could assert on their use.
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, c... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 22fb31e317022c5426ca8d8093410f95029130a3 | 16,577 | https://github.com/jashkenas/coffeescript/blob/22fb31e317022c5426ca8d8093410f95029130a3/test/repl.coffee | 88 | 132 | ||
jashkenas/coffeescript:test/repl.coffee:4:completion | completion | input.emitLine ''
eq '....... ', output.lastWrite(0)
testRepl "evaluates multiline", (input, output) ->
# Stubs. Could assert on their use.
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, c... | input.emitLine 'a ?= 42'
eq '42', output.lastWrite()
testRepl "keeps running after runtime error", (input, output) ->
input.emitLine 'a = b'
input.emitLine 'a'
eq 'undefined', output.lastWrite()
testRepl "#4604: wraps an async function", (input, output) ->
return unless global.supportsAsync
input.emitLine... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 22fb31e317022c5426ca8d8093410f95029130a3 | 16,577 | https://github.com/jashkenas/coffeescript/blob/22fb31e317022c5426ca8d8093410f95029130a3/test/repl.coffee | 88 | 132 |
jashkenas/coffeescript:test/repl.coffee:4:raw_corpus | raw_corpus | input.emitLine ''
eq '....... ', output.lastWrite(0)
testRepl "evaluates multiline", (input, output) ->
# Stubs. Could assert on their use.
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, c... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 671486989f8a39ed99ee585325167bb97ce38849 | 16,577 | https://github.com/jashkenas/coffeescript/blob/671486989f8a39ed99ee585325167bb97ce38849/test/repl.coffee | 88 | 128 | ||
jashkenas/coffeescript:test/repl.coffee:4:completion | completion | input.emitLine ''
eq '....... ', output.lastWrite(0)
testRepl "evaluates multiline", (input, output) ->
# Stubs. Could assert on their use.
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, c... | testRepl "existential assignment of previously declared variable", (input, output) ->
input.emitLine 'a = null'
input.emitLine 'a ?= 42'
eq '42', output.lastWrite()
testRepl "keeps running after runtime error", (input, output) ->
input.emitLine 'a = b'
input.emitLine 'a'
eq 'undefined', output.lastWrite()
... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 671486989f8a39ed99ee585325167bb97ce38849 | 16,577 | https://github.com/jashkenas/coffeescript/blob/671486989f8a39ed99ee585325167bb97ce38849/test/repl.coffee | 88 | 128 |
jashkenas/coffeescript:test/repl.coffee:1:raw_corpus | raw_corpus | class MockInputStream extends Stream
constructor: ->
@readable = true
resume: ->
emitLine: (val) ->
@emit 'data', new Buffer("#{val}\n") | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | fecdbac291ea1f6f11daaaed31a4c63173bad37a | 16,577 | https://github.com/jashkenas/coffeescript/blob/fecdbac291ea1f6f11daaaed31a4c63173bad37a/test/repl.coffee | 11 | 18 | ||
jashkenas/coffeescript:test/repl.coffee:1:completion | completion | class MockInputStream extends Stream
constructor: ->
@readable = true | resume: ->
emitLine: (val) ->
@emit 'data', new Buffer("#{val}\n") | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | fecdbac291ea1f6f11daaaed31a4c63173bad37a | 16,577 | https://github.com/jashkenas/coffeescript/blob/fecdbac291ea1f6f11daaaed31a4c63173bad37a/test/repl.coffee | 11 | 18 |
jashkenas/coffeescript:test/repl.coffee:2:raw_corpus | raw_corpus | class MockOutputStream extends Stream
constructor: ->
@writable = true
@written = []
write: (data) ->
#console.log 'output write', arguments
@written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history file
historyFile... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | fecdbac291ea1f6f11daaaed31a4c63173bad37a | 16,577 | https://github.com/jashkenas/coffeescript/blob/fecdbac291ea1f6f11daaaed31a4c63173bad37a/test/repl.coffee | 20 | 34 | ||
jashkenas/coffeescript:test/repl.coffee:2:completion | completion | class MockOutputStream extends Stream
constructor: ->
@writable = true
@written = []
write: (data) ->
#console.log 'output write', arguments | @written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history file
historyFile = path.join os.tmpdir(), '.coffee_history_test'
fs.writeFileSync historyFile, '1 + 2\n' | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | fecdbac291ea1f6f11daaaed31a4c63173bad37a | 16,577 | https://github.com/jashkenas/coffeescript/blob/fecdbac291ea1f6f11daaaed31a4c63173bad37a/test/repl.coffee | 20 | 34 |
jashkenas/coffeescript:test/repl.coffee:4:raw_corpus | raw_corpus | input.emitLine ''
eq '....... ', output.lastWrite(0)
testRepl "evaluates multiline", (input, output) ->
# Stubs. Could assert on their use.
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, c... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | fecdbac291ea1f6f11daaaed31a4c63173bad37a | 16,577 | https://github.com/jashkenas/coffeescript/blob/fecdbac291ea1f6f11daaaed31a4c63173bad37a/test/repl.coffee | 86 | 119 | ||
jashkenas/coffeescript:test/repl.coffee:4:completion | completion | input.emitLine ''
eq '....... ', output.lastWrite(0)
testRepl "evaluates multiline", (input, output) ->
# Stubs. Could assert on their use.
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, c... | input.emitLine 'a'
eq '2', output.lastWrite()
testRepl "existential assignment of previously declared variable", (input, output) ->
input.emitLine 'a = null'
input.emitLine 'a ?= 42'
eq '42', output.lastWrite()
testRepl "keeps running after runtime error", (input, output) ->
input.emitLine 'a = b'
input.e... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | fecdbac291ea1f6f11daaaed31a4c63173bad37a | 16,577 | https://github.com/jashkenas/coffeescript/blob/fecdbac291ea1f6f11daaaed31a4c63173bad37a/test/repl.coffee | 86 | 119 |
jashkenas/coffeescript:test/repl.coffee:3:raw_corpus | raw_corpus | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 36 | 85 | ||
jashkenas/coffeescript:test/repl.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl)... | var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, repl);
});
};
ctrlV = {
ctrl: true,
name: 'v'
};
t... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 36 | 85 |
jashkenas/coffeescript:test/repl.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ctrlV, testRepl;
testRepl = function(desc, fn) {
var input, output, repl;
input = new MockInputStream();
output = new MockOutputStream();
repl = Repl.start({input, output, historyFile});
return test(desc, function() {
return fn(input, output, rep... | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 36 | 85 |
jashkenas/coffeescript:test/repl.coffee:3:completion | completion | testRepl = (desc, fn) ->
input = new MockInputStream
output = new MockOutputStream
repl = Repl.start {input, output, historyFile}
test desc, -> fn input, output, repl
ctrlV = { ctrl: true, name: 'v'}
testRepl 'reads history file', (input, output, repl) ->
input.emitLine repl.rli.history[0]
eq '3', output... | input.emitLine '"1 + 1\\n"'
eq "'1 + 1\\n'", output.lastWrite()
testRepl "variables are saved", (input, output) ->
input.emitLine "foo = 'foo'"
input.emitLine 'foobar = "#{foo}bar"'
eq "'foobar'", output.lastWrite()
testRepl "empty command evaluates to undefined", (input, output) ->
input.emitLine ''
eq '... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 36 | 85 |
jashkenas/coffeescript:test/repl.coffee:4:raw_corpus | raw_corpus | output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, output) ->
input.emitLine 'a = 1'
input.emitLine 'do ->... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 86 | 114 | ||
jashkenas/coffeescript:test/repl.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, ou... | output.cursorTo = function(pos) {
output.clearLine = function() {};
input.emit('keypress', null, ctrlV);
input.emitLine('do ->');
input.emitLine(' 1 + 1');
input.emit('keypress', null, ctrlV);
return eq('2', output.lastWrite());
};
testRepl("variables in scope are preserved", function(input, output) {
i... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 86 | 114 |
jashkenas/coffeescript:test/repl.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
output.cursorTo = function(pos) {
output.clearLine = function() {};
input.emit('keypress', null, ctrlV);
input.emitLine('do ->');
input.emitLine(' 1 + 1');
input.emit('keypress', null, ctrlV);
return eq('2', output.lastWrite());
};
testRepl("variables... | output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, output) ->
input.emitLine 'a = 1'
input.emitLine 'do ->... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 86 | 114 |
jashkenas/coffeescript:test/repl.coffee:4:completion | completion | output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, output) ->
input.emitLine 'a = 1'
input.emitLine 'do ->... | testRepl "existential assignment of previously declared variable", (input, output) ->
input.emitLine 'a = null'
input.emitLine 'a ?= 42'
eq '42', output.lastWrite()
testRepl "keeps running after runtime error", (input, output) ->
input.emitLine 'a = b'
input.emitLine 'a'
eq 'undefined', output.lastWrite()
... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f | 16,577 | https://github.com/jashkenas/coffeescript/blob/98c1a3a0450cd9b14eeb5b2ce210cb91e515d83f/test/repl.coffee | 86 | 114 |
jashkenas/coffeescript:test/repl.coffee:4:raw_corpus | raw_corpus | output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, output) ->
input.emitLine 'a = 1'
input.emitLine 'do ->... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3108244c20a015de5be19bf0c39da499d7362968 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3108244c20a015de5be19bf0c39da499d7362968/test/repl.coffee | 86 | 112 | ||
jashkenas/coffeescript:test/repl.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, ou... | output.cursorTo = function(pos) {
output.clearLine = function() {};
input.emit('keypress', null, ctrlV);
input.emitLine('do ->');
input.emitLine(' 1 + 1');
input.emit('keypress', null, ctrlV);
return eq('2', output.lastWrite());
};
testRepl("variables in scope are preserved", function(input, output) {
i... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3108244c20a015de5be19bf0c39da499d7362968 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3108244c20a015de5be19bf0c39da499d7362968/test/repl.coffee | 86 | 112 |
jashkenas/coffeescript:test/repl.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
output.cursorTo = function(pos) {
output.clearLine = function() {};
input.emit('keypress', null, ctrlV);
input.emitLine('do ->');
input.emitLine(' 1 + 1');
input.emit('keypress', null, ctrlV);
return eq('2', output.lastWrite());
};
testRepl("variables... | output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, output) ->
input.emitLine 'a = 1'
input.emitLine 'do ->... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3108244c20a015de5be19bf0c39da499d7362968 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3108244c20a015de5be19bf0c39da499d7362968/test/repl.coffee | 86 | 112 |
jashkenas/coffeescript:test/repl.coffee:4:completion | completion | output.cursorTo = (pos) ->
output.clearLine = ->
input.emit 'keypress', null, ctrlV
input.emitLine 'do ->'
input.emitLine ' 1 + 1'
input.emit 'keypress', null, ctrlV
eq '2', output.lastWrite()
testRepl "variables in scope are preserved", (input, output) ->
input.emitLine 'a = 1'
input.emitLine 'do ->... | eq '2', output.lastWrite()
testRepl "existential assignment of previously declared variable", (input, output) ->
input.emitLine 'a = null'
input.emitLine 'a ?= 42'
eq '42', output.lastWrite()
testRepl "keeps running after runtime error", (input, output) ->
input.emitLine 'a = b'
input.emitLine 'a'
eq 'und... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 3108244c20a015de5be19bf0c39da499d7362968 | 16,577 | https://github.com/jashkenas/coffeescript/blob/3108244c20a015de5be19bf0c39da499d7362968/test/repl.coffee | 86 | 112 |
jashkenas/coffeescript:test/repl.coffee:2:raw_corpus | raw_corpus | class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments
@written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history fil... | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 8d81804feebacd639f4b9de8819a113e0445c471 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8d81804feebacd639f4b9de8819a113e0445c471/test/repl.coffee | 19 | 34 | ||
jashkenas/coffeescript:test/repl.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments
@written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fr... | var MockOutputStream, historyFile;
MockOutputStream = class MockOutputStream extends Stream {
constructor() {
super();
this.writable = true;
this.written = [];
}
write(data) {
// console.log 'output write', arguments
return this.written.push(data);
}
lastWrite(fromEnd = -1) {
return... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/repl.coffee | MIT | 8d81804feebacd639f4b9de8819a113e0445c471 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8d81804feebacd639f4b9de8819a113e0445c471/test/repl.coffee | 19 | 34 |
jashkenas/coffeescript:test/repl.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var MockOutputStream, historyFile;
MockOutputStream = class MockOutputStream extends Stream {
constructor() {
super();
this.writable = true;
this.written = [];
}
write(data) {
// console.log 'output write', arguments
return this.written.... | class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments
@written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history fil... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 8d81804feebacd639f4b9de8819a113e0445c471 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8d81804feebacd639f4b9de8819a113e0445c471/test/repl.coffee | 19 | 34 |
jashkenas/coffeescript:test/repl.coffee:2:completion | completion | class MockOutputStream extends Stream
constructor: ->
super()
@writable = true
@written = []
write: (data) ->
# console.log 'output write', arguments | @written.push data
lastWrite: (fromEnd = -1) ->
@written[@written.length - 1 + fromEnd].replace /\r?\n$/, ''
# Create a dummy history file
historyFile = '.coffee_history_test'
fs.writeFileSync historyFile, '1 + 2\n' | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/repl.coffee | MIT | 8d81804feebacd639f4b9de8819a113e0445c471 | 16,577 | https://github.com/jashkenas/coffeescript/blob/8d81804feebacd639f4b9de8819a113e0445c471/test/repl.coffee | 19 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:raw_corpus | raw_corpus | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/humanize.coffee | 1 | 38 | ||
nevir/groc:lib/utils/humanize.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if ... | var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` ${conjunctive} `);
}
},
capitalize: function(sen... | CoffeeScript | JavaScript | nevir/groc | lib/utils/humanize.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/humanize.coffee | 1 | 38 |
nevir/groc:lib/utils/humanize.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` $... | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | JavaScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/humanize.coffee | 1 | 38 |
nevir/groc:lib/utils/humanize.coffee:1:completion | completion | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | pluralizationRules: [
{ regex: /([bcdfghjklmnpqrstvwxz])y$/, replacement: '$1ies' },
{ regex: /(ch|sh|x|ss|s)$/, replacement: '$1es' },
{ regex: /$/, replacement: 's' }
]
pluralize: (word) ->
return word.replace(rule.regex, rule.replacement) for rule in humanize.pluralizationRules when rule.regex.t... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | ac60f4050f1bd0ee25198ac18beb22b40c1a0543 | 579 | https://github.com/nevir/groc/blob/ac60f4050f1bd0ee25198ac18beb22b40c1a0543/lib/utils/humanize.coffee | 1 | 38 |
nevir/groc:lib/utils/humanize.coffee:1:raw_corpus | raw_corpus | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 0ea2e0fd8ed7fd357198163bf864779919639a2b | 579 | https://github.com/nevir/groc/blob/0ea2e0fd8ed7fd357198163bf864779919639a2b/lib/utils/humanize.coffee | 1 | 34 | ||
nevir/groc:lib/utils/humanize.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if ... | var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` ${conjunctive} `);
}
},
capitalize: function(sen... | CoffeeScript | JavaScript | nevir/groc | lib/utils/humanize.coffee | MIT | 0ea2e0fd8ed7fd357198163bf864779919639a2b | 579 | https://github.com/nevir/groc/blob/0ea2e0fd8ed7fd357198163bf864779919639a2b/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` $... | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | JavaScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 0ea2e0fd8ed7fd357198163bf864779919639a2b | 579 | https://github.com/nevir/groc/blob/0ea2e0fd8ed7fd357198163bf864779919639a2b/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:completion | completion | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | else
'a'
pluralizationRules: [
{ regex: /([bcdfghjklmnpqrstvwxz])y$/, replacement: '$1ies' },
{ regex: /(ch|sh|x|ss|s)$/, replacement: '$1es' },
{ regex: /$/, replacement: 's' }
]
pluralize: (word) ->
return word.replace(rule.regex, rule.replacement) for rule in humanize.pluralizationRules... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 0ea2e0fd8ed7fd357198163bf864779919639a2b | 579 | https://github.com/nevir/groc/blob/0ea2e0fd8ed7fd357198163bf864779919639a2b/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:raw_corpus | raw_corpus | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 89669dc7b71576058713bc3d01035b2be85af119 | 579 | https://github.com/nevir/groc/blob/89669dc7b71576058713bc3d01035b2be85af119/lib/utils/humanize.coffee | 1 | 34 | ||
nevir/groc:lib/utils/humanize.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if ... | var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` ${conjunctive} `);
}
},
capitalize: function(sen... | CoffeeScript | JavaScript | nevir/groc | lib/utils/humanize.coffee | MIT | 89669dc7b71576058713bc3d01035b2be85af119 | 579 | https://github.com/nevir/groc/blob/89669dc7b71576058713bc3d01035b2be85af119/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` $... | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | JavaScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 89669dc7b71576058713bc3d01035b2be85af119 | 579 | https://github.com/nevir/groc/blob/89669dc7b71576058713bc3d01035b2be85af119/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:completion | completion | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | else
'a'
pluralizationRules: [
{ regex: /([bcdfghjklmnpqrstvwxz])y$/, replacement: '$1ies' },
{ regex: /(ch|sh|x|ss|s)$/, replacement: '$1es' },
{ regex: /$/, replacement: 's' }
]
pluralize: (word) ->
return word.replace(rule.regex, rule.replacement) for rule in humanize.pluralizationRules... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 89669dc7b71576058713bc3d01035b2be85af119 | 579 | https://github.com/nevir/groc/blob/89669dc7b71576058713bc3d01035b2be85af119/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:raw_corpus | raw_corpus | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 9dce1b4df29a83360b242816659edca3b74f5dce | 579 | https://github.com/nevir/groc/blob/9dce1b4df29a83360b242816659edca3b74f5dce/lib/utils/humanize.coffee | 1 | 34 | ||
nevir/groc:lib/utils/humanize.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if ... | var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` ${conjunctive} `);
}
},
capitalize: function(sen... | CoffeeScript | JavaScript | nevir/groc | lib/utils/humanize.coffee | MIT | 9dce1b4df29a83360b242816659edca3b74f5dce | 579 | https://github.com/nevir/groc/blob/9dce1b4df29a83360b242816659edca3b74f5dce/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` $... | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | JavaScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 9dce1b4df29a83360b242816659edca3b74f5dce | 579 | https://github.com/nevir/groc/blob/9dce1b4df29a83360b242816659edca3b74f5dce/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:completion | completion | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | else
'a'
pluralizationRules: [
{ regex: /([bcdfghjklmnpqrstvwxz])y$/, replacement: '$1ies' },
{ regex: /(ch|sh|x|ss|s)$/, replacement: '$1es' },
{ regex: /$/, replacement: 's' }
]
pluralize: (word) ->
return word.replace(rule.regex, rule.replacement) for rule in humanize.pluralizationRules... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 9dce1b4df29a83360b242816659edca3b74f5dce | 579 | https://github.com/nevir/groc/blob/9dce1b4df29a83360b242816659edca3b74f5dce/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:raw_corpus | raw_corpus | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 6f0a47781507b9a2a33d13c17a2d09cf3d02c19a | 579 | https://github.com/nevir/groc/blob/6f0a47781507b9a2a33d13c17a2d09cf3d02c19a/lib/utils/humanize.coffee | 1 | 34 | ||
nevir/groc:lib/utils/humanize.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if ... | var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` ${conjunctive} `);
}
},
capitalize: function(sen... | CoffeeScript | JavaScript | nevir/groc | lib/utils/humanize.coffee | MIT | 6f0a47781507b9a2a33d13c17a2d09cf3d02c19a | 579 | https://github.com/nevir/groc/blob/6f0a47781507b9a2a33d13c17a2d09cf3d02c19a/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` $... | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | JavaScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 6f0a47781507b9a2a33d13c17a2d09cf3d02c19a | 579 | https://github.com/nevir/groc/blob/6f0a47781507b9a2a33d13c17a2d09cf3d02c19a/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:completion | completion | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
parts = sentence.match /^(\s*)([_\*... | else
'a'
pluralizationRules: [
{ regex: /([bcdfghjklmnpqrstvwxz])y$/, replacement: '$1ies' },
{ regex: /(ch|sh|x|ss|s)$/, replacement: '$1es' },
{ regex: /$/, replacement: 's' }
]
pluralize: (word) ->
return word.replace(rule.regex, rule.replacement) for rule in humanize.pluralizationRules... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 6f0a47781507b9a2a33d13c17a2d09cf3d02c19a | 579 | https://github.com/nevir/groc/blob/6f0a47781507b9a2a33d13c17a2d09cf3d02c19a/lib/utils/humanize.coffee | 1 | 34 |
nevir/groc:lib/utils/humanize.coffee:1:raw_corpus | raw_corpus | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
console.log(sentence)
parts =... | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 21d50e34e5b12b435dbd35ff1401dd050f26b8d0 | 579 | https://github.com/nevir/groc/blob/21d50e34e5b12b435dbd35ff1401dd050f26b8d0/lib/utils/humanize.coffee | 1 | 35 | ||
nevir/groc:lib/utils/humanize.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if ... | var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` ${conjunctive} `);
}
},
capitalize: function(sen... | CoffeeScript | JavaScript | nevir/groc | lib/utils/humanize.coffee | MIT | 21d50e34e5b12b435dbd35ff1401dd050f26b8d0 | 579 | https://github.com/nevir/groc/blob/21d50e34e5b12b435dbd35ff1401dd050f26b8d0/lib/utils/humanize.coffee | 1 | 35 |
nevir/groc:lib/utils/humanize.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var humanize;
module.exports = humanize = {
joinSentence: function(parts, conjunctive = 'and') {
if (parts.length > 2) {
return [parts.slice(0, -1).join(', '), parts[parts.length - 1]].join(`, ${conjunctive} `);
} else {
return parts.join(` $... | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
console.log(sentence)
parts =... | JavaScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 21d50e34e5b12b435dbd35ff1401dd050f26b8d0 | 579 | https://github.com/nevir/groc/blob/21d50e34e5b12b435dbd35ff1401dd050f26b8d0/lib/utils/humanize.coffee | 1 | 35 |
nevir/groc:lib/utils/humanize.coffee:1:completion | completion | module.exports = humanize =
joinSentence: (parts, conjunctive='and') ->
if parts.length > 2
[parts[0..-2].join(', '), parts[parts.length - 1]].join(", #{conjunctive} ")
else
parts.join(" #{conjunctive} ")
capitalize: (sentence) ->
if sentence.length
console.log(sentence)
parts =... | 'an'
else
'a'
pluralizationRules: [
{ regex: /([bcdfghjklmnpqrstvwxz])y$/, replacement: '$1ies' },
{ regex: /(ch|sh|x|ss|s)$/, replacement: '$1es' },
{ regex: /$/, replacement: 's' }
]
pluralize: (word) ->
return word.replace(rule.regex, rule.replacement) for rule in humanize.pluraliza... | CoffeeScript | CoffeeScript | nevir/groc | lib/utils/humanize.coffee | MIT | 21d50e34e5b12b435dbd35ff1401dd050f26b8d0 | 579 | https://github.com/nevir/groc/blob/21d50e34e5b12b435dbd35ff1401dd050f26b8d0/lib/utils/humanize.coffee | 1 | 35 |
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:1:raw_corpus | raw_corpus | describe 'util: url', ->
beforeEach ->
@url = require 'util/url'
describe 'function: isInRoutes:', ->
url = null
beforeEach ->
url = 'http://jianliao.com' # location.origin
it 'should match jianliao urls', ->
href = 'http://jianliao.com'
expect(@url.isInRoutes(url, href)).toBe ... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 1 | 41 | ||
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'util: url', ->
beforeEach ->
@url = require 'util/url'
describe 'function: isInRoutes:', ->
url = null
beforeEach ->
url = 'http://jianliao.com' # location.origin
it 'should match jianliao urls', ->
href = 'http://jia... | describe('util: url', function() {
beforeEach(function() {
return this.url = require('util/url');
});
return describe('function: isInRoutes:', function() {
var url;
url = null;
beforeEach(function() {
return url = 'http://jianliao.com'; // location.origin
});
it('should match jianlia... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 1 | 41 |
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('util: url', function() {
beforeEach(function() {
return this.url = require('util/url');
});
return describe('function: isInRoutes:', function() {
var url;
url = null;
beforeEach(function() {
return url = 'http://jianliao.com'; ... | describe 'util: url', ->
beforeEach ->
@url = require 'util/url'
describe 'function: isInRoutes:', ->
url = null
beforeEach ->
url = 'http://jianliao.com' # location.origin
it 'should match jianliao urls', ->
href = 'http://jianliao.com'
expect(@url.isInRoutes(url, href)).toBe ... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 1 | 41 |
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:1:completion | completion | describe 'util: url', ->
beforeEach ->
@url = require 'util/url'
describe 'function: isInRoutes:', ->
url = null
beforeEach ->
url = 'http://jianliao.com' # location.origin
it 'should match jianliao urls', ->
href = 'http://jianliao.com'
expect(@url.isInRoutes(url, href)).toBe ... | href = 'http://jianliao.com/team/xxx/room/yyy'
expect(@url.isInRoutes(url, href)).toBe true
it 'should not match jianliao short url', ->
href = 'http://jianliao.com/t/shorturl'
expect(@url.isInRoutes(url, href)).toBe false
it 'should not match /site', ->
href = 'http://jianliao.com/sit... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 1 | 41 |
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:2:raw_corpus | raw_corpus | it 'should not match /doc', ->
href = 'http://jianliao.com/doc'
expect(@url.isInRoutes(url, href)).toBe false
href = 'http://jianliao.com/doc/xxx'
expect(@url.isInRoutes(url, href)).toBe false
it 'should not match /page', ->
href = 'http://jianliao.com/page'
expect(@url.isInRou... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 43 | 81 | ||
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should not match /doc', ->
href = 'http://jianliao.com/doc'
expect(@url.isInRoutes(url, href)).toBe false
href = 'http://jianliao.com/doc/xxx'
expect(@url.isInRoutes(url, href)).toBe false
it 'should not match /page', ->
hr... | it('should not match /doc', function() {
var href;
href = 'http://jianliao.com/doc';
expect(this.url.isInRoutes(url, href)).toBe(false);
href = 'http://jianliao.com/doc/xxx';
return expect(this.url.isInRoutes(url, href)).toBe(false);
});
it('should not match /page', function() {
var href;
href = 'http://... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 43 | 81 |
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should not match /doc', function() {
var href;
href = 'http://jianliao.com/doc';
expect(this.url.isInRoutes(url, href)).toBe(false);
href = 'http://jianliao.com/doc/xxx';
return expect(this.url.isInRoutes(url, href)).toBe(false);
});
it('should not m... | it 'should not match /doc', ->
href = 'http://jianliao.com/doc'
expect(@url.isInRoutes(url, href)).toBe false
href = 'http://jianliao.com/doc/xxx'
expect(@url.isInRoutes(url, href)).toBe false
it 'should not match /page', ->
href = 'http://jianliao.com/page'
expect(@url.isInRou... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 43 | 81 |
jianliaoim/talk-os:talk-web/test/spec/util/url.spec.coffee:2:completion | completion | it 'should not match /doc', ->
href = 'http://jianliao.com/doc'
expect(@url.isInRoutes(url, href)).toBe false
href = 'http://jianliao.com/doc/xxx'
expect(@url.isInRoutes(url, href)).toBe false
it 'should not match /page', ->
href = 'http://jianliao.com/page'
expect(@url.isInRou... | expect(@url.isInRoutes(url, href)).toBe false
href = 'http://jianliao.com/v3'
expect(@url.isInRoutes(url, href)).toBe false
href = 'http://jianliao.com/v1/xxx'
expect(@url.isInRoutes(url, href)).toBe false
href = 'http://jianliao.com/v2/xxx'
expect(@url.isInRoutes(url, href)).toBe... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/util/url.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/url.spec.coffee | 43 | 81 |
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:1:raw_corpus | raw_corpus | {redis, limbo} = require '../lib/components'
Promise = require 'bluebird'
{
UserRuntimeModel
} = limbo.use 'talk'
exports.up = (next) ->
unreadPromise = redis.keysAsync 'c:u:*'
.each (key) ->
parts = key.split(':')
_userId = parts[2]
_teamId = parts[4]
return unless _userId and _teamId
redis.... | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{redis, limbo} = require '../lib/components'
Promise = require 'bluebird'
{
UserRuntimeModel
} = limbo.use 'talk'
exports.up = (next) ->
unreadPromise = redis.keysAsync 'c:u:*'
.each (key) ->
parts = key.split(':')
_userId = parts[2]
_teamId = ... | var Promise, UserRuntimeModel, limbo, redis;
({redis, limbo} = require('../lib/components'));
Promise = require('bluebird');
({UserRuntimeModel} = limbo.use('talk'));
exports.up = function(next) {
var latestReadMessageIdPromise, pinnedAtPromise, unreadPromise;
unreadPromise = redis.keysAsync('c:u:*').each(funct... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Promise, UserRuntimeModel, limbo, redis;
({redis, limbo} = require('../lib/components'));
Promise = require('bluebird');
({UserRuntimeModel} = limbo.use('talk'));
exports.up = function(next) {
var latestReadMessageIdPromise, pinnedAtPromise, unreadPromise... | {redis, limbo} = require '../lib/components'
Promise = require 'bluebird'
{
UserRuntimeModel
} = limbo.use 'talk'
exports.up = (next) ->
unreadPromise = redis.keysAsync 'c:u:*'
.each (key) ->
parts = key.split(':')
_userId = parts[2]
_teamId = parts[4]
return unless _userId and _teamId
redis.... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:1:completion | completion | {redis, limbo} = require '../lib/components'
Promise = require 'bluebird'
{
UserRuntimeModel
} = limbo.use 'talk'
exports.up = (next) ->
unreadPromise = redis.keysAsync 'c:u:*'
.each (key) ->
parts = key.split(':')
_userId = parts[2]
_teamId = parts[4]
return unless _userId and _teamId
redis.... | # lrmi:#{_userId}:t:#{_teamId}
latestReadMessageIdPromise = redis.keysAsync 'lrmi:*'
.each (key) ->
parts = key.split ':'
_userId = parts[1]
_teamId = parts[3]
return unless _userId and _teamId
redis.hgetallAsync key
.then (latestReadMessageIds) ->
return unless latestReadMessageIds
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:2:raw_corpus | raw_corpus | Promise.each Object.keys(pinnedAts), (_targetId) ->
pinnedAt = Number(pinnedAts[_targetId])
return unless pinnedAt
console.log 'save pinned at', _userId, _teamId, _targetId, pinnedAt
conditions = _id: _userId
update = {}
update["pinnedAts.#{_teamId}.#{_targetId}"] = pinne... | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 51 | 66 | ||
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Promise.each Object.keys(pinnedAts), (_targetId) ->
pinnedAt = Number(pinnedAts[_targetId])
return unless pinnedAt
console.log 'save pinned at', _userId, _teamId, _targetId, pinnedAt
conditions = _id: _userId
update = {}
... | Promise.each(Object.keys(pinnedAts), function(_targetId) {
var conditions, options, pinnedAt, update;
pinnedAt = Number(pinnedAts[_targetId]);
if (!pinnedAt) {
return;
}
console.log('save pinned at', _userId, _teamId, _targetId, pinnedAt);
conditions = {
_id: _userId
};
update = {};
update[`pi... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 51 | 66 |
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Promise.each(Object.keys(pinnedAts), function(_targetId) {
var conditions, options, pinnedAt, update;
pinnedAt = Number(pinnedAts[_targetId]);
if (!pinnedAt) {
return;
}
console.log('save pinned at', _userId, _teamId, _targetId, pinnedAt);
condition... | Promise.each Object.keys(pinnedAts), (_targetId) ->
pinnedAt = Number(pinnedAts[_targetId])
return unless pinnedAt
console.log 'save pinned at', _userId, _teamId, _targetId, pinnedAt
conditions = _id: _userId
update = {}
update["pinnedAts.#{_teamId}.#{_targetId}"] = pinne... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 51 | 66 |
jianliaoim/talk-os:talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee:2:completion | completion | Promise.each Object.keys(pinnedAts), (_targetId) ->
pinnedAt = Number(pinnedAts[_targetId])
return unless pinnedAt
console.log 'save pinned at', _userId, _teamId, _targetId, pinnedAt
conditions = _id: _userId
update = {}
update["pinnedAts.#{_teamId}.#{_targetId}"] = pinne... | UserRuntimeModel.updateAsync conditions, update, options
Promise.all [unreadPromise, latestReadMessageIdPromise, pinnedAtPromise]
.then -> next()
.catch next
exports.down = (next) ->
next() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1423907153189-migrate-redis-to-mongo.coffee | 51 | 66 |
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:1:raw_corpus | raw_corpus | dispatcher = require '../dispatcher'
exports.saveDraft = (_teamId, _channelId, draft) ->
dispatcher.handleViewAction
type: 'draft/draft-save'
data:
_teamId: _teamId
_channelId: _channelId
draft: draft
exports.clearDraft = (_teamId, _channelId) ->
dispatcher.handleViewAction
type: 'dr... | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
dispatcher = require '../dispatcher'
exports.saveDraft = (_teamId, _channelId, draft) ->
dispatcher.handleViewAction
type: 'draft/draft-save'
data:
_teamId: _teamId
_channelId: _channelId
draft: draft
exports.clearDraft = (_teamId, _... | var dispatcher;
dispatcher = require('../dispatcher');
exports.saveDraft = function(_teamId, _channelId, draft) {
return dispatcher.handleViewAction({
type: 'draft/draft-save',
data: {
_teamId: _teamId,
_channelId: _channelId,
draft: draft
}
});
};
exports.clearDraft = function(_tea... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var dispatcher;
dispatcher = require('../dispatcher');
exports.saveDraft = function(_teamId, _channelId, draft) {
return dispatcher.handleViewAction({
type: 'draft/draft-save',
data: {
_teamId: _teamId,
_channelId: _channelId,
draft: d... | dispatcher = require '../dispatcher'
exports.saveDraft = (_teamId, _channelId, draft) ->
dispatcher.handleViewAction
type: 'draft/draft-save'
data:
_teamId: _teamId
_channelId: _channelId
draft: draft
exports.clearDraft = (_teamId, _channelId) ->
dispatcher.handleViewAction
type: 'dr... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:1:completion | completion | dispatcher = require '../dispatcher'
exports.saveDraft = (_teamId, _channelId, draft) ->
dispatcher.handleViewAction
type: 'draft/draft-save'
data:
_teamId: _teamId
_channelId: _channelId
draft: draft
exports.clearDraft = (_teamId, _channelId) ->
dispatcher.handleViewAction
type: 'dr... | exports.clearPost = (_teamId, _channelId) ->
dispatcher.handleViewAction
type: 'draft/post-delete'
data:
_teamId: _teamId
_channelId: _channelId
exports.saveSnippet = (_teamId, _channelId, snippet) ->
dispatcher.handleViewAction
type: 'draft/snippet-save'
data:
_teamId: _teamId
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:2:raw_corpus | raw_corpus | data:
_teamId: _teamId
data: storyData
category: storyCategory
exports.deleteStoryDraft = (_teamId, storyCategory) ->
dispatcher.handleViewAction
type: 'draft/story/delete'
data:
_teamId: _teamId
category: storyCategory
exports.deleteAllStoryDraft = (_teamId) ->
dispatcher.ha... | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 51 | 72 | ||
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
data:
_teamId: _teamId
data: storyData
category: storyCategory
exports.deleteStoryDraft = (_teamId, storyCategory) ->
dispatcher.handleViewAction
type: 'draft/story/delete'
data:
_teamId: _teamId
category: storyCategory
e... | ({
data: {
_teamId: _teamId,
data: storyData,
category: storyCategory
}
});
exports.deleteStoryDraft = function(_teamId, storyCategory) {
return dispatcher.handleViewAction({
type: 'draft/story/delete',
data: {
_teamId: _teamId,
category: storyCategory
}
});
};
exports.dele... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 51 | 72 |
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
data: {
_teamId: _teamId,
data: storyData,
category: storyCategory
}
});
exports.deleteStoryDraft = function(_teamId, storyCategory) {
return dispatcher.handleViewAction({
type: 'draft/story/delete',
data: {
_teamId: _teamId,
... | data:
_teamId: _teamId
data: storyData
category: storyCategory
exports.deleteStoryDraft = (_teamId, storyCategory) ->
dispatcher.handleViewAction
type: 'draft/story/delete'
data:
_teamId: _teamId
category: storyCategory
exports.deleteAllStoryDraft = (_teamId) ->
dispatcher.ha... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 51 | 72 |
jianliaoim/talk-os:talk-web/client/actions/draft.coffee:2:completion | completion | data:
_teamId: _teamId
data: storyData
category: storyCategory
exports.deleteStoryDraft = (_teamId, storyCategory) ->
dispatcher.handleViewAction
type: 'draft/story/delete'
data:
_teamId: _teamId
category: storyCategory | exports.deleteAllStoryDraft = (_teamId) ->
dispatcher.handleViewAction
type: 'draft/story/delete-all'
data:
_teamId: _teamId
exports.toggleMarkdown = (status) ->
dispatcher.handleViewAction
type: 'draft/toggle-markdown'
data: status | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/actions/draft.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/actions/draft.coffee | 51 | 72 |
Nedomas/databound:spec/crud/find.coffee:1:raw_corpus | raw_corpus | describe '#find', ->
it 'should single record when it exists', ->
records = [
{ id: 1, name: 'Nikki' }
{ id: 2, name: 'John' }
]
stubResponse success: true, records: records, ->
User.find(1).then (user) ->
expect(user).to.eql(id: 1, name: 'Nikki')
it 'should undefined when it... | CoffeeScript | Nedomas/databound | spec/crud/find.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find.coffee | 1 | 15 | ||
Nedomas/databound:spec/crud/find.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe '#find', ->
it 'should single record when it exists', ->
records = [
{ id: 1, name: 'Nikki' }
{ id: 2, name: 'John' }
]
stubResponse success: true, records: records, ->
User.find(1).then (user) ->
expect(user).to.... | describe('#find', function() {
it('should single record when it exists', function() {
var records;
records = [
{
id: 1,
name: 'Nikki'
},
{
id: 2,
name: 'John'
}
];
return stubResponse({
success: true,
records: records
}, function(... | CoffeeScript | JavaScript | Nedomas/databound | spec/crud/find.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find.coffee | 1 | 15 |
Nedomas/databound:spec/crud/find.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('#find', function() {
it('should single record when it exists', function() {
var records;
records = [
{
id: 1,
name: 'Nikki'
},
{
id: 2,
name: 'John'
}
];
return stubResponse({
... | describe '#find', ->
it 'should single record when it exists', ->
records = [
{ id: 1, name: 'Nikki' }
{ id: 2, name: 'John' }
]
stubResponse success: true, records: records, ->
User.find(1).then (user) ->
expect(user).to.eql(id: 1, name: 'Nikki')
it 'should undefined when it... | JavaScript | CoffeeScript | Nedomas/databound | spec/crud/find.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find.coffee | 1 | 15 |
Nedomas/databound:spec/crud/find.coffee:1:completion | completion | describe '#find', ->
it 'should single record when it exists', ->
records = [
{ id: 1, name: 'Nikki' }
{ id: 2, name: 'John' }
] | stubResponse success: true, records: records, ->
User.find(1).then (user) ->
expect(user).to.eql(id: 1, name: 'Nikki')
it 'should undefined when it doesnt exist', ->
stubResponse success: true, records: [], ->
User.find(1).then (user) ->
expect(user).to.eql(undefined) | CoffeeScript | CoffeeScript | Nedomas/databound | spec/crud/find.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/spec/crud/find.coffee | 1 | 15 |
gterrono/houston:client/document_view.coffee:1:raw_corpus | raw_corpus | Template._houston_document_view.helpers
collection_info: -> Houston._collections.collections.findOne {@name}
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@d... | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/document_view.coffee | 1 | 36 | ||
gterrono/houston:client/document_view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Template._houston_document_view.helpers
collection_info: -> Houston._collections.collections.findOne {@name}
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for fiel... | Template._houston_document_view.helpers({
collection_info: function() {
return Houston._collections.collections.findOne({name: this.name});
},
showSaved: function() {
return Houston._session('show_saved');
},
fields: function() {
var field, fields, i, len, result, value;
fields = Houston._get_... | CoffeeScript | JavaScript | gterrono/houston | client/document_view.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/document_view.coffee | 1 | 36 |
gterrono/houston:client/document_view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Template._houston_document_view.helpers({
collection_info: function() {
return Houston._collections.collections.findOne({name: this.name});
},
showSaved: function() {
return Houston._session('show_saved');
},
fields: function() {
var field, fi... | Template._houston_document_view.helpers
collection_info: -> Houston._collections.collections.findOne {@name}
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@d... | JavaScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/document_view.coffee | 1 | 36 |
gterrono/houston:client/document_view.coffee:1:completion | completion | Template._houston_document_view.helpers
collection_info: -> Houston._collections.collections.findOne {@name}
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@d... | 'click #houston-save': (e) ->
e.preventDefault()
update_dict = {}
for field in $('.houston-field')
field_name = field.name.split(' ')[0]
unless field_name is '_id'
update_dict[field_name] = Houston._convert_to_correct_type(field_name, field.value, @collection)
Houston._call("#{@name}... | CoffeeScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 581357048f3577f0487ed598e26eaf063c813183 | 802 | https://github.com/gterrono/houston/blob/581357048f3577f0487ed598e26eaf063c813183/client/document_view.coffee | 1 | 36 |
gterrono/houston:client/document_view.coffee:1:raw_corpus | raw_corpus | Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info.method_names or [])
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([... | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 6cad3def1b3494427ee4ba491cb60c950cdb9238 | 802 | https://github.com/gterrono/houston/blob/6cad3def1b3494427ee4ba491cb60c950cdb9238/client/document_view.coffee | 1 | 41 | ||
gterrono/houston:client/document_view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info.method_names or [])
showSaved: -> Houston._session('sho... | Template._houston_document_view.helpers({
custom_actions: function() {
var action, collection_info, i, len, ref, results;
collection_info = Houston._collections.collections.findOne({name: this.name});
ref = collection_info.method_names || [];
results = [];
for (i = 0, len = ref.length; i < len; i+... | CoffeeScript | JavaScript | gterrono/houston | client/document_view.coffee | MIT | 6cad3def1b3494427ee4ba491cb60c950cdb9238 | 802 | https://github.com/gterrono/houston/blob/6cad3def1b3494427ee4ba491cb60c950cdb9238/client/document_view.coffee | 1 | 41 |
gterrono/houston:client/document_view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Template._houston_document_view.helpers({
custom_actions: function() {
var action, collection_info, i, len, ref, results;
collection_info = Houston._collections.collections.findOne({name: this.name});
ref = collection_info.method_names || [];
resu... | Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info.method_names or [])
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([... | JavaScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 6cad3def1b3494427ee4ba491cb60c950cdb9238 | 802 | https://github.com/gterrono/houston/blob/6cad3def1b3494427ee4ba491cb60c950cdb9238/client/document_view.coffee | 1 | 41 |
gterrono/houston:client/document_view.coffee:1:completion | completion | Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info.method_names or [])
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([... | 'click .custom-houston-action': (e) ->
e.preventDefault()
'click #houston-save': (e) ->
e.preventDefault()
Meteor.call Houston._custom_method_name(@collection, @action), @document, Houston._show_flash
update_dict = {}
for field in $('.houston-field')
field_name = field.name.split(' ')[0]
... | CoffeeScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 6cad3def1b3494427ee4ba491cb60c950cdb9238 | 802 | https://github.com/gterrono/houston/blob/6cad3def1b3494427ee4ba491cb60c950cdb9238/client/document_view.coffee | 1 | 41 |
gterrono/houston:client/document_view.coffee:1:raw_corpus | raw_corpus | Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info?.method_names or [])
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields(... | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 601b4da3c1aef49a2782993c4d168081a961270a | 802 | https://github.com/gterrono/houston/blob/601b4da3c1aef49a2782993c4d168081a961270a/client/document_view.coffee | 1 | 41 | ||
gterrono/houston:client/document_view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info?.method_names or [])
showSaved: -> Houston._session('sh... | Template._houston_document_view.helpers({
custom_actions: function() {
var action, collection_info, i, len, ref, results;
collection_info = Houston._collections.collections.findOne({name: this.name});
ref = (collection_info != null ? collection_info.method_names : void 0) || [];
results = [];
for ... | CoffeeScript | JavaScript | gterrono/houston | client/document_view.coffee | MIT | 601b4da3c1aef49a2782993c4d168081a961270a | 802 | https://github.com/gterrono/houston/blob/601b4da3c1aef49a2782993c4d168081a961270a/client/document_view.coffee | 1 | 41 |
gterrono/houston:client/document_view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Template._houston_document_view.helpers({
custom_actions: function() {
var action, collection_info, i, len, ref, results;
collection_info = Houston._collections.collections.findOne({name: this.name});
ref = (collection_info != null ? collection_info.m... | Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info?.method_names or [])
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields(... | JavaScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 601b4da3c1aef49a2782993c4d168081a961270a | 802 | https://github.com/gterrono/houston/blob/601b4da3c1aef49a2782993c4d168081a961270a/client/document_view.coffee | 1 | 41 |
gterrono/houston:client/document_view.coffee:1:completion | completion | Template._houston_document_view.helpers
custom_actions: ->
collection_info = Houston._collections.collections.findOne {@name}
{@document, collection: @name, action} for action in (collection_info?.method_names or [])
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields(... | 'click .custom-houston-action': (e) ->
e.preventDefault()
'click #houston-save': (e) ->
e.preventDefault()
Meteor.call Houston._custom_method_name(@collection, @action), @document, Houston._show_flash
update_dict = {}
for field in $('.houston-field')
field_name = field.name.split(' ')[0]
... | CoffeeScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 601b4da3c1aef49a2782993c4d168081a961270a | 802 | https://github.com/gterrono/houston/blob/601b4da3c1aef49a2782993c4d168081a961270a/client/document_view.coffee | 1 | 41 |
gterrono/houston:client/document_view.coffee:1:raw_corpus | raw_corpus | Template._houston_document_view.helpers
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@document, field.name)
result.push(name: "#{field.name} (#{typeof v... | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 88416c2f00292e941d6c6b8ce328f7e318738106 | 802 | https://github.com/gterrono/houston/blob/88416c2f00292e941d6c6b8ce328f7e318738106/client/document_view.coffee | 1 | 35 | ||
gterrono/houston:client/document_view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Template._houston_document_view.helpers
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@document, field... | Template._houston_document_view.helpers({
showSaved: function() {
return Houston._session('show_saved');
},
fields: function() {
var field, fields, i, len, result, value;
fields = Houston._get_fields([this.document], {
exclude_id: true
});
result = [];
for (i = 0, len = fields.length... | CoffeeScript | JavaScript | gterrono/houston | client/document_view.coffee | MIT | 88416c2f00292e941d6c6b8ce328f7e318738106 | 802 | https://github.com/gterrono/houston/blob/88416c2f00292e941d6c6b8ce328f7e318738106/client/document_view.coffee | 1 | 35 |
gterrono/houston:client/document_view.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Template._houston_document_view.helpers({
showSaved: function() {
return Houston._session('show_saved');
},
fields: function() {
var field, fields, i, len, result, value;
fields = Houston._get_fields([this.document], {
exclude_id: true
}... | Template._houston_document_view.helpers
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@document, field.name)
result.push(name: "#{field.name} (#{typeof v... | JavaScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 88416c2f00292e941d6c6b8ce328f7e318738106 | 802 | https://github.com/gterrono/houston/blob/88416c2f00292e941d6c6b8ce328f7e318738106/client/document_view.coffee | 1 | 35 |
gterrono/houston:client/document_view.coffee:1:completion | completion | Template._houston_document_view.helpers
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@document, field.name)
result.push(name: "#{field.name} (#{typeof v... | 'click #houston-save': (e) ->
e.preventDefault()
update_dict = {}
for field in $('.houston-field')
field_name = field.name.split(' ')[0]
unless field_name is '_id'
update_dict[field_name] = Houston._convert_to_correct_type(field_name, field.value, @collection)
Houston._call("#{@name}... | CoffeeScript | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | 88416c2f00292e941d6c6b8ce328f7e318738106 | 802 | https://github.com/gterrono/houston/blob/88416c2f00292e941d6c6b8ce328f7e318738106/client/document_view.coffee | 1 | 35 |
gterrono/houston:client/document_view.coffee:1:raw_corpus | raw_corpus | Template._houston_document_view.helpers
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@document, field.name)
result.push(name: "#{field.name} (#{typeof v... | CoffeeScript | gterrono/houston | client/document_view.coffee | MIT | cb55ba7cbb4cf58e2e03a7588a8639f75c21965a | 802 | https://github.com/gterrono/houston/blob/cb55ba7cbb4cf58e2e03a7588a8639f75c21965a/client/document_view.coffee | 1 | 40 | ||
gterrono/houston:client/document_view.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Template._houston_document_view.helpers
showSaved: -> Houston._session('show_saved')
fields: ->
fields = Houston._get_fields([@document], exclude_id: true)
result = []
for field in fields
value = Houston._nested_field_lookup(@document, field... | Template._houston_document_view.helpers({
showSaved: function() {
return Houston._session('show_saved');
},
fields: function() {
var field, fields, i, len, result, value;
fields = Houston._get_fields([this.document], {
exclude_id: true
});
result = [];
for (i = 0, len = fields.length... | CoffeeScript | JavaScript | gterrono/houston | client/document_view.coffee | MIT | cb55ba7cbb4cf58e2e03a7588a8639f75c21965a | 802 | https://github.com/gterrono/houston/blob/cb55ba7cbb4cf58e2e03a7588a8639f75c21965a/client/document_view.coffee | 1 | 40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.