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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rs/pushd:lib/api.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.setupRestApi = (app, createDevice) ->
# Device registration
app.post '/devices', (req, res) ->
try
fields = filterFields(req.body)
createDevice fields, (device, created) ->
device.get (info) ->
... | exports.setupRestApi = function(app, createDevice) {
// Device registration
app.post('/devices', function(req, res) {
var error, fields;
try {
fields = filterFields(req.body);
return createDevice(fields, function(device, created) {
return device.get(function(info) {
info.id = d... | CoffeeScript | JavaScript | rs/pushd | lib/api.coffee | MIT | 1023eedc22c4742d8ed1a290cd82b82b5be5cd9d | 1,157 | https://github.com/rs/pushd/blob/1023eedc22c4742d8ed1a290cd82b82b5be5cd9d/lib/api.coffee | 6 | 55 |
rs/pushd:lib/api.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.setupRestApi = function(app, createDevice) {
// Device registration
app.post('/devices', function(req, res) {
var error, fields;
try {
fields = filterFields(req.body);
return createDevice(fields, function(device, created) {
r... | exports.setupRestApi = (app, createDevice) ->
# Device registration
app.post '/devices', (req, res) ->
try
fields = filterFields(req.body)
createDevice fields, (device, created) ->
device.get (info) ->
info.id = device.id
re... | JavaScript | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 1023eedc22c4742d8ed1a290cd82b82b5be5cd9d | 1,157 | https://github.com/rs/pushd/blob/1023eedc22c4742d8ed1a290cd82b82b5be5cd9d/lib/api.coffee | 6 | 55 |
rs/pushd:lib/api.coffee:2:completion | completion | exports.setupRestApi = (app, createDevice) ->
# Device registration
app.post '/devices', (req, res) ->
try
fields = filterFields(req.body)
createDevice fields, (device, created) ->
device.get (info) ->
info.id = device.id
re... | app.delete '/device/:device_id', (req, res) ->
req.device.delete (deleted) ->
res.send if deleted then 204 else 404
# Get device subscriptions
app.get '/device/:device_id/subscriptions', (req, res) ->
req.device.getSubscriptions (subs) ->
if subs?
subsAnd... | CoffeeScript | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 1023eedc22c4742d8ed1a290cd82b82b5be5cd9d | 1,157 | https://github.com/rs/pushd/blob/1023eedc22c4742d8ed1a290cd82b82b5be5cd9d/lib/api.coffee | 6 | 55 |
rs/pushd:lib/api.coffee:3:raw_corpus | raw_corpus | options = 0
if req.body.ignore_message
options |= event.OPTION_IGNORE_MESSAGE
req.device.addSubscription req.event, options, (added) ->
if added? # added is null if device doesn't exist
res.send if added then 201 else 204
else
res.send ... | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 1023eedc22c4742d8ed1a290cd82b82b5be5cd9d | 1,157 | https://github.com/rs/pushd/blob/1023eedc22c4742d8ed1a290cd82b82b5be5cd9d/lib/api.coffee | 56 | 83 | ||
rs/pushd:lib/api.coffee:3:completion | completion | options = 0
if req.body.ignore_message
options |= event.OPTION_IGNORE_MESSAGE
req.device.addSubscription req.event, options, (added) ->
if added? # added is null if device doesn't exist
res.send if added then 201 else 204
else
res.send ... | # Event stats
app.get '/event/:event_id', (req, res) ->
req.event.info (info) ->
res.json info, if info? then 200 else 404
# Publish an event
app.post '/event/:event_id', (req, res) ->
res.send 204
req.event.publish(req.body)
# Delete an event
app.delete '/event... | CoffeeScript | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 1023eedc22c4742d8ed1a290cd82b82b5be5cd9d | 1,157 | https://github.com/rs/pushd/blob/1023eedc22c4742d8ed1a290cd82b82b5be5cd9d/lib/api.coffee | 56 | 83 |
rs/pushd:lib/api.coffee:2:raw_corpus | raw_corpus | exports.setupRestApi = (app) ->
# Device registration
app.post '/devices', (req, res) ->
try
fields = filterFields(req.body)
device.createDevice redis, fields, (device, created) ->
device.get (info) ->
res.header 'Location', "/device/#{device.i... | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/api.coffee | 6 | 55 | ||
rs/pushd:lib/api.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.setupRestApi = (app) ->
# Device registration
app.post '/devices', (req, res) ->
try
fields = filterFields(req.body)
device.createDevice redis, fields, (device, created) ->
device.get (info) ->
... | exports.setupRestApi = function(app) {
// Device registration
app.post('/devices', function(req, res) {
var error, fields;
try {
fields = filterFields(req.body);
return device.createDevice(redis, fields, function(device, created) {
return device.get(function(info) {
res.header(... | CoffeeScript | JavaScript | rs/pushd | lib/api.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/api.coffee | 6 | 55 |
rs/pushd:lib/api.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.setupRestApi = function(app) {
// Device registration
app.post('/devices', function(req, res) {
var error, fields;
try {
fields = filterFields(req.body);
return device.createDevice(redis, fields, function(device, created) {
r... | exports.setupRestApi = (app) ->
# Device registration
app.post '/devices', (req, res) ->
try
fields = filterFields(req.body)
device.createDevice redis, fields, (device, created) ->
device.get (info) ->
res.header 'Location', "/device/#{device.i... | JavaScript | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/api.coffee | 6 | 55 |
rs/pushd:lib/api.coffee:2:completion | completion | exports.setupRestApi = (app) ->
# Device registration
app.post '/devices', (req, res) ->
try
fields = filterFields(req.body)
device.createDevice redis, fields, (device, created) ->
device.get (info) ->
res.header 'Location', "/device/#{device.i... | req.device.delete (deleted) ->
res.send if deleted then 204 else 404
# Get device subscriptions
app.get '/device/:device_id/subscriptions', (req, res) ->
req.device.getSubscriptions (subs) ->
if subs?
subsAndOptions = {}
for sub in subs
... | CoffeeScript | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/api.coffee | 6 | 55 |
rs/pushd:lib/api.coffee:3:raw_corpus | raw_corpus | if req.body.ignore_message
options |= event.OPTION_IGNORE_MESSAGE
req.device.addSubscription req.event, options, (added) ->
if added? # added is null if device doesn't exist
res.send if added then 201 else 204
else
res.send 404
# Unsubscri... | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/api.coffee | 56 | 82 | ||
rs/pushd:lib/api.coffee:3:completion | completion | if req.body.ignore_message
options |= event.OPTION_IGNORE_MESSAGE
req.device.addSubscription req.event, options, (added) ->
if added? # added is null if device doesn't exist
res.send if added then 201 else 204
else
res.send 404
# Unsubscri... | # Event stats
app.get '/event/:event_id', (req, res) ->
req.event.info (info) ->
res.json info, if info? then 200 else 404
# Publish an event
app.post '/event/:event_id', (req, res) ->
res.send 204
req.event.publish(req.body)
# Delete an event
app.delete '/event... | CoffeeScript | CoffeeScript | rs/pushd | lib/api.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/api.coffee | 56 | 82 |
lmaccherone/node-localstorage:test/es6-test.coffee:1:raw_corpus | raw_corpus | {LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./scratch9')
localStorage['a'] = 'something'
test.equal(... | CoffeeScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/es6-test.coffee | 1 | 20 | ||
lmaccherone/node-localstorage:test/es6-test.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./sc... | var LocalStorage, tape;
({LocalStorage} = require('../'));
tape = require('tape');
tape('array and dot notation', (test) => { // TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
var localStorage;
localStorage = new LocalStorage('./scratch... | CoffeeScript | JavaScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/es6-test.coffee | 1 | 20 |
lmaccherone/node-localstorage:test/es6-test.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var LocalStorage, tape;
({LocalStorage} = require('../'));
tape = require('tape');
tape('array and dot notation', (test) => { // TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
var loc... | {LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./scratch9')
localStorage['a'] = 'something'
test.equal(... | JavaScript | CoffeeScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/es6-test.coffee | 1 | 20 |
lmaccherone/node-localstorage:test/es6-test.coffee:1:completion | completion | {LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./scratch9')
localStorage['a'] = 'something'
test.equal(... | test.equal(localStorage[''], 'something else')
localStorage.b = 1
test.equal(localStorage['b'], '1')
test.deepEqual(Object.keys(localStorage), ['a', '', 'b'])
localStorage._deleteLocation()
test.end()
) | CoffeeScript | CoffeeScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | 23eff752dc603ad9559c50739589d3ec673c07f7 | 460 | https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/es6-test.coffee | 1 | 20 |
lmaccherone/node-localstorage:test/es6-test.coffee:1:raw_corpus | raw_corpus | {LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./scratch9')
localStorage['a'] = 'something'
test.equal(... | CoffeeScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | a26877ea55a43437e6de8447a538e76689230ffd | 460 | https://github.com/lmaccherone/node-localstorage/blob/a26877ea55a43437e6de8447a538e76689230ffd/test/es6-test.coffee | 1 | 18 | ||
lmaccherone/node-localstorage:test/es6-test.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./sc... | var LocalStorage, tape;
({LocalStorage} = require('../'));
tape = require('tape');
tape('array and dot notation', (test) => { // TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
var localStorage;
localStorage = new LocalStorage('./scratch... | CoffeeScript | JavaScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | a26877ea55a43437e6de8447a538e76689230ffd | 460 | https://github.com/lmaccherone/node-localstorage/blob/a26877ea55a43437e6de8447a538e76689230ffd/test/es6-test.coffee | 1 | 18 |
lmaccherone/node-localstorage:test/es6-test.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var LocalStorage, tape;
({LocalStorage} = require('../'));
tape = require('tape');
tape('array and dot notation', (test) => { // TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
var loc... | {LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./scratch9')
localStorage['a'] = 'something'
test.equal(... | JavaScript | CoffeeScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | a26877ea55a43437e6de8447a538e76689230ffd | 460 | https://github.com/lmaccherone/node-localstorage/blob/a26877ea55a43437e6de8447a538e76689230ffd/test/es6-test.coffee | 1 | 18 |
lmaccherone/node-localstorage:test/es6-test.coffee:1:completion | completion | {LocalStorage} = require('../')
tape = require('tape')
tape('array and dot notation', (test) => # TODO: These tests are inadequate in that it will pass even when there is no Proxy object. Need to check for file existence.
localStorage = new LocalStorage('./scratch9')
localStorage['a'] = 'something'
test.equal(... | localStorage[''] = 'something else'
test.equal(localStorage[''], 'something else')
localStorage.b = 1
test.equal(localStorage['b'], '1')
localStorage._deleteLocation()
test.end()
) | CoffeeScript | CoffeeScript | lmaccherone/node-localstorage | test/es6-test.coffee | MIT | a26877ea55a43437e6de8447a538e76689230ffd | 460 | https://github.com/lmaccherone/node-localstorage/blob/a26877ea55a43437e6de8447a538e76689230ffd/test/es6-test.coffee | 1 | 18 |
jianliaoim/talk-os:talk-api2x/migrations/1417402043969-remove-robot-member.coffee:1:raw_corpus | raw_corpus | exports.up = (next) ->
mongo ->
robots = db.users.find isRobot: true
robots.forEach (robot) ->
return if robot.name is 'talkai'
db.members.remove user: robot._id
next()
exports.down = (next) ->
next() | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1417402043969-remove-robot-member.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417402043969-remove-robot-member.coffee | 1 | 10 | ||
jianliaoim/talk-os:talk-api2x/migrations/1417402043969-remove-robot-member.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.up = (next) ->
mongo ->
robots = db.users.find isRobot: true
robots.forEach (robot) ->
return if robot.name is 'talkai'
db.members.remove user: robot._id
next()
exports.down = (next) ->
next()
``` | exports.up = function(next) {
mongo(function() {
var robots;
robots = db.users.find({
isRobot: true
});
return robots.forEach(function(robot) {
if (robot.name === 'talkai') {
return;
}
return db.members.remove({
user: robot._id
});
});
});
return n... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/migrations/1417402043969-remove-robot-member.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417402043969-remove-robot-member.coffee | 1 | 10 |
jianliaoim/talk-os:talk-api2x/migrations/1417402043969-remove-robot-member.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.up = function(next) {
mongo(function() {
var robots;
robots = db.users.find({
isRobot: true
});
return robots.forEach(function(robot) {
if (robot.name === 'talkai') {
return;
}
return db.members.remove({
... | exports.up = (next) ->
mongo ->
robots = db.users.find isRobot: true
robots.forEach (robot) ->
return if robot.name is 'talkai'
db.members.remove user: robot._id
next()
exports.down = (next) ->
next() | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1417402043969-remove-robot-member.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417402043969-remove-robot-member.coffee | 1 | 10 |
jianliaoim/talk-os:talk-api2x/migrations/1417402043969-remove-robot-member.coffee:1:completion | completion | exports.up = (next) ->
mongo ->
robots = db.users.find isRobot: true
robots.forEach (robot) ->
return if robot.name is 'talkai' | db.members.remove user: robot._id
next()
exports.down = (next) ->
next() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/migrations/1417402043969-remove-robot-member.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/migrations/1417402043969-remove-robot-member.coffee | 1 | 10 |
andreyvit/json-diff:old-coffee-lib/cli.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
tty = require 'tty'
{ diff } = require './index'
{ colorize } = require './colorize'
module.exports = (argv) ->
options = require('dreamopt') [
"Usage: json-diff [-vjCk] first.json second.json"
"Arguments:"
" first.json Old file #var(file1) #required"
" second.json... | CoffeeScript | andreyvit/json-diff | old-coffee-lib/cli.coffee | MIT | 76adeca7de9c86bb156dfecf6e3f43dc4237ab02 | 1,205 | https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/cli.coffee | 1 | 48 | ||
andreyvit/json-diff:old-coffee-lib/cli.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
fs = require 'fs'
tty = require 'tty'
{ diff } = require './index'
{ colorize } = require './colorize'
module.exports = (argv) ->
options = require('dreamopt') [
"Usage: json-diff [-vjCk] first.json second.json"
"Arguments:"
" first.json ... | var colorize, diff, fs, tty;
fs = require('fs');
tty = require('tty');
({diff} = require('./index'));
({colorize} = require('./colorize'));
module.exports = function(argv) {
var data1, data2, json1, json2, options, result;
options = require('dreamopt')(["Usage: json-diff [-vjCk] first.json second.json", "Argum... | CoffeeScript | JavaScript | andreyvit/json-diff | old-coffee-lib/cli.coffee | MIT | 76adeca7de9c86bb156dfecf6e3f43dc4237ab02 | 1,205 | https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/cli.coffee | 1 | 48 |
andreyvit/json-diff:old-coffee-lib/cli.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var colorize, diff, fs, tty;
fs = require('fs');
tty = require('tty');
({diff} = require('./index'));
({colorize} = require('./colorize'));
module.exports = function(argv) {
var data1, data2, json1, json2, options, result;
options = require('dreamopt')(["U... | fs = require 'fs'
tty = require 'tty'
{ diff } = require './index'
{ colorize } = require './colorize'
module.exports = (argv) ->
options = require('dreamopt') [
"Usage: json-diff [-vjCk] first.json second.json"
"Arguments:"
" first.json Old file #var(file1) #required"
" second.json... | JavaScript | CoffeeScript | andreyvit/json-diff | old-coffee-lib/cli.coffee | MIT | 76adeca7de9c86bb156dfecf6e3f43dc4237ab02 | 1,205 | https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/cli.coffee | 1 | 48 |
andreyvit/json-diff:old-coffee-lib/cli.coffee:1:completion | completion | fs = require 'fs'
tty = require 'tty'
{ diff } = require './index'
{ colorize } = require './colorize'
module.exports = (argv) ->
options = require('dreamopt') [
"Usage: json-diff [-vjCk] first.json second.json"
"Arguments:"
" first.json Old file #var(file1) #required"
" second.json... | data1 = fs.readFileSync(options.file1, 'utf8')
data2 = fs.readFileSync(options.file2, 'utf8')
process.stderr.write "Parsing old file...\n" if options.verbose
json1 = JSON.parse(data1)
process.stderr.write "Parsing new file...\n" if options.verbose
json2 = JSON.parse(data2)
process.stderr.write "Running ... | CoffeeScript | CoffeeScript | andreyvit/json-diff | old-coffee-lib/cli.coffee | MIT | 76adeca7de9c86bb156dfecf6e3f43dc4237ab02 | 1,205 | https://github.com/andreyvit/json-diff/blob/76adeca7de9c86bb156dfecf6e3f43dc4237ab02/old-coffee-lib/cli.coffee | 1 | 48 |
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:1:raw_corpus | raw_corpus | generateAndStoreToken = require '../../lib/generateAndStoreToken'
describe 'generateAndStoreToken', ->
beforeEach ->
@sut = generateAndStoreToken
describe 'when called with a uuid and a callback', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
Device:... | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 1 | 40 | ||
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
generateAndStoreToken = require '../../lib/generateAndStoreToken'
describe 'generateAndStoreToken', ->
beforeEach ->
@sut = generateAndStoreToken
describe 'when called with a uuid and a callback', ->
beforeEach (done) ->
Device = sinon.spy()
... | var generateAndStoreToken;
generateAndStoreToken = require('../../lib/generateAndStoreToken');
describe('generateAndStoreToken', function() {
beforeEach(function() {
return this.sut = generateAndStoreToken;
});
describe('when called with a uuid and a callback', function() {
beforeEach(function(done) {
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var generateAndStoreToken;
generateAndStoreToken = require('../../lib/generateAndStoreToken');
describe('generateAndStoreToken', function() {
beforeEach(function() {
return this.sut = generateAndStoreToken;
});
describe('when called with a uuid and a ca... | generateAndStoreToken = require '../../lib/generateAndStoreToken'
describe 'generateAndStoreToken', ->
beforeEach ->
@sut = generateAndStoreToken
describe 'when called with a uuid and a callback', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
Device:... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:1:completion | completion | generateAndStoreToken = require '../../lib/generateAndStoreToken'
describe 'generateAndStoreToken', ->
beforeEach ->
@sut = generateAndStoreToken
describe 'when called with a uuid and a callback', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
Device:... | it 'should return no error', ->
expect(@error).to.not.exist
it 'should have a token in the result', ->
expect(@result.token).to.equal 'charizard'
it 'should instantiate a Device with the uuid', ->
expect(@dependencies.Device).to.have.been.calledWith uuid: 'ccc2f14f-3a64-4aa0-b64c-8e62fbd52ea... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 1 | 40 |
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:2:raw_corpus | raw_corpus | @dependencies = Device: Device, getDevice: @getDevice, securityImpl: @securityImpl
storeResults = (@error, @result) => done()
@sut {}, {uuid:'267fb089-1d2e-46cb-be13-9de4e75db441'}, storeResults, @dependencies
it 'should have a token in the result', ->
expect(@result.token).to.equal 'pikachu'
... | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 42 | 80 | ||
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:2:completion | completion | @dependencies = Device: Device, getDevice: @getDevice, securityImpl: @securityImpl
storeResults = (@error, @result) => done()
@sut {}, {uuid:'267fb089-1d2e-46cb-be13-9de4e75db441'}, storeResults, @dependencies
it 'should have a token in the result', ->
expect(@result.token).to.equal 'pikachu'
... | @getDevice = sinon.stub().yields null, uuid: '267fb089-1d2e-46cb-be13-9de4e75db441'
@securityImpl = canConfigure: sinon.stub().yields null, true
@dependencies = Device: Device, getDevice: @getDevice, securityImpl: @securityImpl
storeResults = (@error, @result) => done()
@sut {}, {uuid:'267fb08... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 42 | 80 |
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:3:raw_corpus | raw_corpus | describe 'called when storeResults yields an error', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
Device::storeToken = sinon.stub().yields new Error()
@getDevice = sinon.stub().yields null, uuid: 'ccc2f14f-3a64-4aa0-b64c-8e62fbd52eaa'
@securityIm... | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 82 | 119 | ||
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'called when storeResults yields an error', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
Device::storeToken = sinon.stub().yields new Error()
@getDevice = sinon.stub().yields null, uuid:... | describe('called when storeResults yields an error', function() {
beforeEach(function(done) {
var Device, storeResults;
Device = sinon.spy();
Device.prototype.generateToken = () => {
return 'charizard';
};
Device.prototype.storeToken = sinon.stub().yields(new Error());
this.getDevice = s... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 82 | 119 |
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('called when storeResults yields an error', function() {
beforeEach(function(done) {
var Device, storeResults;
Device = sinon.spy();
Device.prototype.generateToken = () => {
return 'charizard';
};
Device.prototype.storeToken = s... | describe 'called when storeResults yields an error', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
Device::storeToken = sinon.stub().yields new Error()
@getDevice = sinon.stub().yields null, uuid: 'ccc2f14f-3a64-4aa0-b64c-8e62fbd52eaa'
@securityIm... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 82 | 119 |
octoblu/meshblu:test/lib/generateAndStoreToken-spec.coffee:3:completion | completion | describe 'called when storeResults yields an error', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
Device::storeToken = sinon.stub().yields new Error()
@getDevice = sinon.stub().yields null, uuid: 'ccc2f14f-3a64-4aa0-b64c-8e62fbd52eaa'
@securityIm... | describe 'when securityImp.canConfigure returns false', ->
beforeEach (done) ->
Device = sinon.spy()
Device::generateToken = => 'charizard'
@getDevice = sinon.stub().yields null, uuid: 'ccc2f14f-3a64-4aa0-b64c-8e62fbd52eaa'
@securityImpl = canConfigure: sinon.stub().yields null, false
... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/generateAndStoreToken-spec.coffee | MIT | 062a3b3907d05d4e937d8773a52f869ddfd29e1b | 815 | https://github.com/octoblu/meshblu/blob/062a3b3907d05d4e937d8773a52f869ddfd29e1b/test/lib/generateAndStoreToken-spec.coffee | 82 | 119 |
Glavin001/atom-beautify:src/beautifiers/rustfmt.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/rust-lang-nursery/rustfmt
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
versionCheckState = false
module.exports = class Rustfmt extends Beautifier
name: "rustfmt"
link: "https://github.com/rust-lang-nursery/rustfmt"
isPreInstalled: false
option... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rustfmt.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/rustfmt.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rustfmt.coffee:1:completion | completion | ###
Requires https://github.com/rust-lang-nursery/rustfmt
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
versionCheckState = false
module.exports = class Rustfmt extends Beautifier
name: "rustfmt"
link: "https://github.com/rust-lang-nursery/rustfmt"
isPreInstalled: false
option... | pathOption: "Rust - Rustfmt Path"
}
# 0.5.0 is a relatively new version at the point of writing,
# but is essential for this to work with stdin.
# => Check for it specifically.
p = if versionCheckState == program
@Promise.resolve()
else
@run(program, ["--version"], help: help)
... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rustfmt.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/rustfmt.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/rustfmt.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/rust-lang-nursery/rustfmt
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
versionCheckState = false
module.exports = class Rustfmt extends Beautifier
name: "rustfmt"
link: "https://github.com/rust-lang-nursery/rustfmt"
isPreInstalled: false
option... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rustfmt.coffee | MIT | 065f9d4a30a244804f12b1f8d995fa8602a462b5 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/065f9d4a30a244804f12b1f8d995fa8602a462b5/src/beautifiers/rustfmt.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rustfmt.coffee:1:completion | completion | ###
Requires https://github.com/rust-lang-nursery/rustfmt
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
versionCheckState = false
module.exports = class Rustfmt extends Beautifier
name: "rustfmt"
link: "https://github.com/rust-lang-nursery/rustfmt"
isPreInstalled: false
option... | pathOption: "Rust - Rustfmt Path"
}
# 0.5.0 is a relatively new version at the point of writing,
# but is essential for this to work with stdin.
# => Check for it specifically.
p = if versionCheckState == program
@Promise.resolve()
else
@run(program, ["--version"], help: help)
... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rustfmt.coffee | MIT | 065f9d4a30a244804f12b1f8d995fa8602a462b5 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/065f9d4a30a244804f12b1f8d995fa8602a462b5/src/beautifiers/rustfmt.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/rustfmt.coffee:1:raw_corpus | raw_corpus | ###
Requires https://github.com/nrc/rustfmt
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
versionCheckState = false
module.exports = class Rustfmt extends Beautifier
name: "rustfmt"
link: "https://github.com/nrc/rustfmt"
isPreInstalled: false
options: {
Rust: true
}
b... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rustfmt.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/rustfmt.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/rustfmt.coffee:1:completion | completion | ###
Requires https://github.com/nrc/rustfmt
###
"use strict"
Beautifier = require('./beautifier')
path = require('path')
versionCheckState = false
module.exports = class Rustfmt extends Beautifier
name: "rustfmt"
link: "https://github.com/nrc/rustfmt"
isPreInstalled: false
options: {
Rust: true
}
b... | pathOption: "Rust - Rustfmt Path"
}
# 0.5.0 is a relatively new version at the point of writing,
# but is essential for this to work with stdin.
# => Check for it specifically.
p = if versionCheckState == program
@Promise.resolve()
else
@run(program, ["--version"], help: help)
... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/rustfmt.coffee | MIT | ba2198675cbcc1ecd05f18e28e97133cdd2d5319 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/ba2198675cbcc1ecd05f18e28e97133cdd2d5319/src/beautifiers/rustfmt.coffee | 1 | 50 |
oozcitak/xmlbuilder-js:src/index.coffee:2:raw_corpus | raw_corpus | module.exports.begin = (options, onData, onEnd) ->
if isFunction(options)
[onData, onEnd] = [options, onData]
options = {}
if onData
new XMLDocumentCB(options, onData, onEnd)
else
new XMLDocument(options) | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 85 | 93 | ||
oozcitak/xmlbuilder-js:src/index.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports.begin = (options, onData, onEnd) ->
if isFunction(options)
[onData, onEnd] = [options, onData]
options = {}
if onData
new XMLDocumentCB(options, onData, onEnd)
else
new XMLDocument(options)
``` | module.exports.begin = function(options, onData, onEnd) {
if (isFunction(options)) {
[onData, onEnd] = [options, onData];
options = {};
}
if (onData) {
return new XMLDocumentCB(options, onData, onEnd);
} else {
return new XMLDocument(options);
}
}; | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 85 | 93 |
oozcitak/xmlbuilder-js:src/index.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports.begin = function(options, onData, onEnd) {
if (isFunction(options)) {
[onData, onEnd] = [options, onData];
options = {};
}
if (onData) {
return new XMLDocumentCB(options, onData, onEnd);
} else {
return new XMLDocument(options... | module.exports.begin = (options, onData, onEnd) ->
if isFunction(options)
[onData, onEnd] = [options, onData]
options = {}
if onData
new XMLDocumentCB(options, onData, onEnd)
else
new XMLDocument(options) | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 85 | 93 |
oozcitak/xmlbuilder-js:src/index.coffee:2:completion | completion | module.exports.begin = (options, onData, onEnd) ->
if isFunction(options)
[onData, onEnd] = [options, onData]
options = {} | if onData
new XMLDocumentCB(options, onData, onEnd)
else
new XMLDocument(options) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 85 | 93 |
oozcitak/xmlbuilder-js:src/index.coffee:4:raw_corpus | raw_corpus | module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options)
module.exports.implementation = new XMLDOMImplementation()
module.exports.nodeType = NodeType
module.exports.writerState = WriterState | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 98 | 104 | ||
oozcitak/xmlbuilder-js:src/index.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options)
module.exports.implementation = new XMLDOMImplementation()
module.exports.nodeType = NodeType
module.exports.writerState = WriterState
``` | module.exports.streamWriter = function(stream, options) {
return new XMLStreamWriter(stream, options);
};
module.exports.implementation = new XMLDOMImplementation();
module.exports.nodeType = NodeType;
module.exports.writerState = WriterState; | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 98 | 104 |
oozcitak/xmlbuilder-js:src/index.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports.streamWriter = function(stream, options) {
return new XMLStreamWriter(stream, options);
};
module.exports.implementation = new XMLDOMImplementation();
module.exports.nodeType = NodeType;
module.exports.writerState = WriterState;
``` | module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options)
module.exports.implementation = new XMLDOMImplementation()
module.exports.nodeType = NodeType
module.exports.writerState = WriterState | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 98 | 104 |
oozcitak/xmlbuilder-js:src/index.coffee:4:completion | completion | module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options) | module.exports.implementation = new XMLDOMImplementation()
module.exports.nodeType = NodeType
module.exports.writerState = WriterState | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/src/index.coffee | 98 | 104 |
oozcitak/xmlbuilder-js:src/index.coffee:4:raw_corpus | raw_corpus | module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options)
module.exports.nodeType = NodeType
module.exports.writerState = WriterState | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | 2aee731105b7e5f1358f2c9ebbe3268339d59727 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/2aee731105b7e5f1358f2c9ebbe3268339d59727/src/index.coffee | 97 | 101 | ||
oozcitak/xmlbuilder-js:src/index.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options)
module.exports.nodeType = NodeType
module.exports.writerState = WriterState
``` | module.exports.streamWriter = function(stream, options) {
return new XMLStreamWriter(stream, options);
};
module.exports.nodeType = NodeType;
module.exports.writerState = WriterState; | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | 2aee731105b7e5f1358f2c9ebbe3268339d59727 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/2aee731105b7e5f1358f2c9ebbe3268339d59727/src/index.coffee | 97 | 101 |
oozcitak/xmlbuilder-js:src/index.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports.streamWriter = function(stream, options) {
return new XMLStreamWriter(stream, options);
};
module.exports.nodeType = NodeType;
module.exports.writerState = WriterState;
``` | module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options)
module.exports.nodeType = NodeType
module.exports.writerState = WriterState | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | 2aee731105b7e5f1358f2c9ebbe3268339d59727 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/2aee731105b7e5f1358f2c9ebbe3268339d59727/src/index.coffee | 97 | 101 |
oozcitak/xmlbuilder-js:src/index.coffee:4:completion | completion | module.exports.streamWriter = (stream, options) ->
new XMLStreamWriter(stream, options) | module.exports.nodeType = NodeType
module.exports.writerState = WriterState | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | src/index.coffee | MIT | 2aee731105b7e5f1358f2c9ebbe3268339d59727 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/2aee731105b7e5f1358f2c9ebbe3268339d59727/src/index.coffee | 97 | 101 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/repl.coffee:1:raw_corpus | raw_corpus | # A very simple Read-Eval-Print-Loop. Compiles one line at a time to JavaScript
# and evaluates it. Good for simple tests, or poking around the **Node.js** API.
# Using it looks like this:
#
# coffee> puts "$num bottles of beer" for num in [99..1]
# Require the **coffee-script** module to get access to the compile... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/repl.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/repl.coffee | 1 | 33 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/repl.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# A very simple Read-Eval-Print-Loop. Compiles one line at a time to JavaScript
# and evaluates it. Good for simple tests, or poking around the **Node.js** API.
# Using it looks like this:
#
# coffee> puts "$num bottles of beer" for num in [99..1]
# Require ... | // A very simple Read-Eval-Print-Loop. Compiles one line at a time to JavaScript
// and evaluates it. Good for simple tests, or poking around the **Node.js** API.
// Using it looks like this:
// coffee> puts "$num bottles of beer" for num in [99..1]
// Require the **coffee-script** module to get access to the com... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/repl.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/repl.coffee | 1 | 33 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/repl.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// A very simple Read-Eval-Print-Loop. Compiles one line at a time to JavaScript
// and evaluates it. Good for simple tests, or poking around the **Node.js** API.
// Using it looks like this:
// coffee> puts "$num bottles of beer" for num in [99..1]
// Requir... | # A very simple Read-Eval-Print-Loop. Compiles one line at a time to JavaScript
# and evaluates it. Good for simple tests, or poking around the **Node.js** API.
# Using it looks like this:
#
# coffee> puts "$num bottles of beer" for num in [99..1]
# Require the **coffee-script** module to get access to the compile... | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/repl.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/repl.coffee | 1 | 33 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/repl.coffee:1:completion | completion | # A very simple Read-Eval-Print-Loop. Compiles one line at a time to JavaScript
# and evaluates it. Good for simple tests, or poking around the **Node.js** API.
# Using it looks like this:
#
# coffee> puts "$num bottles of beer" for num in [99..1]
# Require the **coffee-script** module to get access to the compile... | }
# The main REPL function. **run** is called every time a line of code is entered.
# Attempt to evaluate the command. If there's an exception, print it out instead
# of exiting.
run: (buffer) ->
try
val: CoffeeScript.run buffer.toString(), {no_wrap: true, globals: true, source: 'repl'}
p val if val isnt und... | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/repl.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/repl.coffee | 1 | 33 |
mojotech/pioneer:src/errorformat.coffee:1:raw_corpus | raw_corpus | color = require('colors')
module.exports = (failure) ->
return format(failure)
format = (failure) ->
message = shorten(failure, 5)
colorFirstLine(message)
shorten = (message, numlines) ->
message.split('\n').splice(0, numlines).join('\n')
colorFirstLine = (message) ->
split = message.split('\n')
split[0]... | CoffeeScript | mojotech/pioneer | src/errorformat.coffee | MIT | 2d3ade85e18e3ea1dfff2545bad4142aa9c496e4 | 523 | https://github.com/mojotech/pioneer/blob/2d3ade85e18e3ea1dfff2545bad4142aa9c496e4/src/errorformat.coffee | 1 | 15 | ||
mojotech/pioneer:src/errorformat.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
color = require('colors')
module.exports = (failure) ->
return format(failure)
format = (failure) ->
message = shorten(failure, 5)
colorFirstLine(message)
shorten = (message, numlines) ->
message.split('\n').splice(0, numlines).join('\n')
colorFirstLin... | var color, colorFirstLine, format, shorten;
color = require('colors');
module.exports = function(failure) {
return format(failure);
};
format = function(failure) {
var message;
message = shorten(failure, 5);
return colorFirstLine(message);
};
shorten = function(message, numlines) {
return message.split('\... | CoffeeScript | JavaScript | mojotech/pioneer | src/errorformat.coffee | MIT | 2d3ade85e18e3ea1dfff2545bad4142aa9c496e4 | 523 | https://github.com/mojotech/pioneer/blob/2d3ade85e18e3ea1dfff2545bad4142aa9c496e4/src/errorformat.coffee | 1 | 15 |
mojotech/pioneer:src/errorformat.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var color, colorFirstLine, format, shorten;
color = require('colors');
module.exports = function(failure) {
return format(failure);
};
format = function(failure) {
var message;
message = shorten(failure, 5);
return colorFirstLine(message);
};
shorten = ... | color = require('colors')
module.exports = (failure) ->
return format(failure)
format = (failure) ->
message = shorten(failure, 5)
colorFirstLine(message)
shorten = (message, numlines) ->
message.split('\n').splice(0, numlines).join('\n')
colorFirstLine = (message) ->
split = message.split('\n')
split[0]... | JavaScript | CoffeeScript | mojotech/pioneer | src/errorformat.coffee | MIT | 2d3ade85e18e3ea1dfff2545bad4142aa9c496e4 | 523 | https://github.com/mojotech/pioneer/blob/2d3ade85e18e3ea1dfff2545bad4142aa9c496e4/src/errorformat.coffee | 1 | 15 |
mojotech/pioneer:src/errorformat.coffee:1:completion | completion | color = require('colors')
module.exports = (failure) ->
return format(failure)
format = (failure) ->
message = shorten(failure, 5)
colorFirstLine(message) | shorten = (message, numlines) ->
message.split('\n').splice(0, numlines).join('\n')
colorFirstLine = (message) ->
split = message.split('\n')
split[0] = split[0].red.inverse
split.join('\n') | CoffeeScript | CoffeeScript | mojotech/pioneer | src/errorformat.coffee | MIT | 2d3ade85e18e3ea1dfff2545bad4142aa9c496e4 | 523 | https://github.com/mojotech/pioneer/blob/2d3ade85e18e3ea1dfff2545bad4142aa9c496e4/src/errorformat.coffee | 1 | 15 |
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:1:raw_corpus | raw_corpus | React = require 'react'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
LinkedStateMixin = require 'react-addons-linked-state-mixin'
query = require '../query'
lang = require '../locales/lang'
CopyArea = React.createFactory require('reac... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
LinkedStateMixin = require 'react-addons-linked-state-mixin'
query = require '../query'
lang = require '../lo... | var CopyArea, Immutable, LinkedStateMixin, PureRenderMixin, React, T, TopicSelector, a, div, img, l, lang, mixinCreateTopic, mixinInteEvents, mixinInteHandler, query, recorder, span;
React = require('react');
recorder = require('actions-recorder');
Immutable = require('immutable');
PureRenderMixin = require('react-... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var CopyArea, Immutable, LinkedStateMixin, PureRenderMixin, React, T, TopicSelector, a, div, img, l, lang, mixinCreateTopic, mixinInteEvents, mixinInteHandler, query, recorder, span;
React = require('react');
recorder = require('actions-recorder');
Immutable = r... | React = require 'react'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
LinkedStateMixin = require 'react-addons-linked-state-mixin'
query = require '../query'
lang = require '../locales/lang'
CopyArea = React.createFactory require('reac... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:1:completion | completion | React = require 'react'
recorder = require 'actions-recorder'
Immutable = require 'immutable'
PureRenderMixin = require 'react-addons-pure-render-mixin'
LinkedStateMixin = require 'react-addons-linked-state-mixin'
query = require '../query'
lang = require '../locales/lang'
CopyArea = React.createFactory require('reac... | displayName: 'inte-email'
mixins: [
LinkedStateMixin
mixinCreateTopic, mixinInteHandler, mixinInteEvents
PureRenderMixin
]
propTypes:
_teamId: T.string
_roomId: T.string
settings: T.object
inte: T.instanceOf(Immutable.Map)
onPageBack: T.func
renderBody: (topic) ->
div c... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:2:raw_corpus | raw_corpus | if topic.get('isGeneral')
fillText = lang.getText('room-general')
else
fillText = topic.get('topic')
text = lang.getText('email-message-%s').replace('%s', fillText)
div className: 'inte-email',
div className: 'inte-board lm-content',
@renderInteHeader()
@renderTopicRow()
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 51 | 62 | ||
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if topic.get('isGeneral')
fillText = lang.getText('room-general')
else
fillText = topic.get('topic')
text = lang.getText('email-message-%s').replace('%s', fillText)
div className: 'inte-email',
div className: 'inte-board lm-content',... | var fillText, text;
if (topic.get('isGeneral')) {
fillText = lang.getText('room-general');
} else {
fillText = topic.get('topic');
}
text = lang.getText('email-message-%s').replace('%s', fillText);
div({
className: 'inte-email'
}, div({
className: 'inte-board lm-content'
}, this.renderInteHeader(), this.rend... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 51 | 62 |
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var fillText, text;
if (topic.get('isGeneral')) {
fillText = lang.getText('room-general');
} else {
fillText = topic.get('topic');
}
text = lang.getText('email-message-%s').replace('%s', fillText);
div({
className: 'inte-email'
}, div({
className: 'inte-... | if topic.get('isGeneral')
fillText = lang.getText('room-general')
else
fillText = topic.get('topic')
text = lang.getText('email-message-%s').replace('%s', fillText)
div className: 'inte-email',
div className: 'inte-board lm-content',
@renderInteHeader()
@renderTopicRow()
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 51 | 62 |
jianliaoim/talk-os:talk-web/client/app/inte-email.coffee:2:completion | completion | if topic.get('isGeneral')
fillText = lang.getText('room-general')
else
fillText = topic.get('topic')
text = lang.getText('email-message-%s').replace('%s', fillText) | div className: 'inte-email',
div className: 'inte-board lm-content',
@renderInteHeader()
@renderTopicRow()
@renderTopicCreate()
@renderBody topic | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/inte-email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/inte-email.coffee | 51 | 62 |
gterrono/houston:test/test_custom_root_route.coffee:1:raw_corpus | raw_corpus | wait = (fn, ms=500) -> casper.wait ms, fn
test = (name, num_tests, url, fn, wait_time=500) ->
casper.test.begin name, num_tests, (test) ->
casper.start url, (response) ->
fn.bind(@)
wait fn, wait_time
casper.run ->
test.done()
test 'User sign up works w/ custom route', 3, 'http://localhost... | CoffeeScript | gterrono/houston | test/test_custom_root_route.coffee | MIT | 46c2ecf9eb546b97b2c516cd150df0295ba3cd0f | 802 | https://github.com/gterrono/houston/blob/46c2ecf9eb546b97b2c516cd150df0295ba3cd0f/test/test_custom_root_route.coffee | 1 | 21 | ||
gterrono/houston:test/test_custom_root_route.coffee:1:completion | completion | wait = (fn, ms=500) -> casper.wait ms, fn
test = (name, num_tests, url, fn, wait_time=500) ->
casper.test.begin name, num_tests, (test) ->
casper.start url, (response) ->
fn.bind(@)
wait fn, wait_time
casper.run ->
test.done() | test 'User sign up works w/ custom route', 3, 'http://localhost:3500/bob', ->
@test.assertUrlMatch /\/bob\/login/, 'redirected to login'
@test.assertExists 'input[value="Sign up"]', 'sign up form exists'
@fill '#houston-sign-in-form'
'houston-email': 'ad@min.com'
'houston-password': 'admin'
true
wai... | CoffeeScript | CoffeeScript | gterrono/houston | test/test_custom_root_route.coffee | MIT | 46c2ecf9eb546b97b2c516cd150df0295ba3cd0f | 802 | https://github.com/gterrono/houston/blob/46c2ecf9eb546b97b2c516cd150df0295ba3cd0f/test/test_custom_root_route.coffee | 1 | 21 |
gterrono/houston:test/test_custom_root_route.coffee:1:raw_corpus | raw_corpus | wait = (fn, ms=500) -> casper.wait ms, fn
test = (name, num_tests, url, fn, wait_time=500) ->
casper.test.begin name, num_tests, (test) ->
casper.start url, (response) ->
fn.bind(@)
wait fn, wait_time
casper.run ->
test.done()
test 'User sign up works w/ custom route', 3, 'http://localhost... | CoffeeScript | gterrono/houston | test/test_custom_root_route.coffee | MIT | 6308677e13df3f91659c87d0790a2d84a5592bec | 802 | https://github.com/gterrono/houston/blob/6308677e13df3f91659c87d0790a2d84a5592bec/test/test_custom_root_route.coffee | 1 | 21 | ||
gterrono/houston:test/test_custom_root_route.coffee:1:completion | completion | wait = (fn, ms=500) -> casper.wait ms, fn
test = (name, num_tests, url, fn, wait_time=500) ->
casper.test.begin name, num_tests, (test) ->
casper.start url, (response) ->
fn.bind(@)
wait fn, wait_time
casper.run ->
test.done() | test 'User sign up works w/ custom route', 3, 'http://localhost:3000/bob', ->
@test.assertUrlMatch /\/bob\/login/, 'redirected to login'
@test.assertExists 'input[value="Sign up"]', 'sign up form exists'
@fill '#houston-sign-in-form'
'houston-email': 'ad@min.com'
'houston-password': 'admin'
true
wai... | CoffeeScript | CoffeeScript | gterrono/houston | test/test_custom_root_route.coffee | MIT | 6308677e13df3f91659c87d0790a2d84a5592bec | 802 | https://github.com/gterrono/houston/blob/6308677e13df3f91659c87d0790a2d84a5592bec/test/test_custom_root_route.coffee | 1 | 21 |
jianliaoim/talk-os:talk-web/client/app/timeline-list.coffee:1:raw_corpus | raw_corpus | React = require 'react'
{div} = React.DOM
module.exports = React.createClass
propTypes:
children: React.PropTypes.any.isRequired
render: ->
div className: 'timeline-list thin-scroll',
@props.children | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/timeline-list.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/timeline-list.coffee | 1 | 12 | ||
jianliaoim/talk-os:talk-web/client/app/timeline-list.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
{div} = React.DOM
module.exports = React.createClass
propTypes:
children: React.PropTypes.any.isRequired
render: ->
div className: 'timeline-list thin-scroll',
@props.children
``` | var React, div;
React = require('react');
({div} = React.DOM);
module.exports = React.createClass({
propTypes: {
children: React.PropTypes.any.isRequired
},
render: function() {
return div({
className: 'timeline-list thin-scroll'
}, this.props.children);
}
}); | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/timeline-list.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/timeline-list.coffee | 1 | 12 |
jianliaoim/talk-os:talk-web/client/app/timeline-list.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var React, div;
React = require('react');
({div} = React.DOM);
module.exports = React.createClass({
propTypes: {
children: React.PropTypes.any.isRequired
},
render: function() {
return div({
className: 'timeline-list thin-scroll'
}, this.... | React = require 'react'
{div} = React.DOM
module.exports = React.createClass
propTypes:
children: React.PropTypes.any.isRequired
render: ->
div className: 'timeline-list thin-scroll',
@props.children | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/timeline-list.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/timeline-list.coffee | 1 | 12 |
jianliaoim/talk-os:talk-web/client/app/timeline-list.coffee:1:completion | completion | React = require 'react'
{div} = React.DOM
module.exports = React.createClass | propTypes:
children: React.PropTypes.any.isRequired
render: ->
div className: 'timeline-list thin-scroll',
@props.children | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/timeline-list.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/timeline-list.coffee | 1 | 12 |
Pagedraw/pagedraw:src/test-stubber.coffee:1:raw_corpus | raw_corpus | ###
Usage:
Production code wants to get the current date, but test code wants to be deterministic, so
it should always be Jan 1, 1970 for test code.
--- in regular code ---
fn = ->
...
now = new Date()
...
--- instead ---
fn = ->
...
now = stubbable "fn:current_date", -> new Date()
...
--- ... | CoffeeScript | Pagedraw/pagedraw | src/test-stubber.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/test-stubber.coffee | 1 | 43 | ||
Pagedraw/pagedraw:src/test-stubber.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Usage:
Production code wants to get the current date, but test code wants to be deterministic, so
it should always be Jan 1, 1970 for test code.
--- in regular code ---
fn = ->
...
now = new Date()
...
--- instead ---
fn = ->
...
now =... | /*
Usage:
Production code wants to get the current date, but test code wants to be deterministic, so
it should always be Jan 1, 1970 for test code.
--- in regular code ---
fn = ->
...
now = new Date()
...
--- instead ---
fn = ->
...
now = stubbable "fn:current_date", -> n... | CoffeeScript | JavaScript | Pagedraw/pagedraw | src/test-stubber.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/test-stubber.coffee | 1 | 43 |
Pagedraw/pagedraw:src/test-stubber.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Usage:
Production code wants to get the current date, but test code wants to be deterministic, so
it should always be Jan 1, 1970 for test code.
--- in regular code ---
fn = ->
...
now = new Date()
...
--- instead ---
fn = ->
... | ###
Usage:
Production code wants to get the current date, but test code wants to be deterministic, so
it should always be Jan 1, 1970 for test code.
--- in regular code ---
fn = ->
...
now = new Date()
...
--- instead ---
fn = ->
...
now = stubbable "fn:current_date", -> new Date()
...
--- ... | JavaScript | CoffeeScript | Pagedraw/pagedraw | src/test-stubber.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/test-stubber.coffee | 1 | 43 |
Pagedraw/pagedraw:src/test-stubber.coffee:1:completion | completion | ###
Usage:
Production code wants to get the current date, but test code wants to be deterministic, so
it should always be Jan 1, 1970 for test code.
--- in regular code ---
fn = ->
...
now = new Date()
...
--- instead ---
fn = ->
...
now = stubbable "fn:current_date", -> new Date()
...
--- ... | stub "fn:current_date", -> new Date("January 1, 1970")
fn()
# fn's `now` variable will be `new Date("January 1, 1970")`
###
registered_stubs = {}
exports.stub = (name, override_impl) ->
registered_stubs[name] = override_impl
exports.stubbable = (name, params..., dfault_impl) ->
registered_stub_exists = (re... | CoffeeScript | CoffeeScript | Pagedraw/pagedraw | src/test-stubber.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/src/test-stubber.coffee | 1 | 43 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:raw_corpus | raw_corpus | angular.module('app').service 'twitterService', ['$log', '$q', '$resource', 'messageService', ($log, $q, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria) ->
defer = $q.defer()
activity... | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474/src/scripts/services/twitterService.coffee | 1 | 22 | ||
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
angular.module('app').service 'twitterService', ['$log', '$q', '$resource', 'messageService', ($log, $q, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSON... | angular.module('app').service('twitterService', [
'$log',
'$q',
'$resource',
'messageService',
function($log,
$q,
$resource,
messageService) {
var activity,
get,
self;
self = this;
activity = $resource('http://search.twitter.com/search.json',
{
callback: 'JSON_CALLBACK'
},
... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474/src/scripts/services/twitterService.coffee | 1 | 22 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
angular.module('app').service('twitterService', [
'$log',
'$q',
'$resource',
'messageService',
function($log,
$q,
$resource,
messageService) {
var activity,
get,
self;
self = this;
activity = $resource('http://search.twitter.com/sear... | angular.module('app').service 'twitterService', ['$log', '$q', '$resource', 'messageService', ($log, $q, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria) ->
defer = $q.defer()
activity... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474/src/scripts/services/twitterService.coffee | 1 | 22 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:completion | completion | angular.module('app').service 'twitterService', ['$log', '$q', '$resource', 'messageService', ($log, $q, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria) ->
defer = $q.defer() | activity.get q: criteria, (results) ->
messageService.publish 'search', source: 'Twitter', criteria: criteria
defer.resolve results.results
, (results) ->
$log.error 'twitterService error', results
defer.reject results
defer.promise
self.get = get
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6506e79cc46ff4b7b0e0aff6b342f6b5a64e9474/src/scripts/services/twitterService.coffee | 1 | 22 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:raw_corpus | raw_corpus | angular.module('app').service 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria, success, failure) ->
activity.get q: criter... | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 59b669bfc11c566bc6e5abf0b235638d734ae2d9 | 672 | https://github.com/CaryLandholt/AngularFun/blob/59b669bfc11c566bc6e5abf0b235638d734ae2d9/src/scripts/services/twitterService.coffee | 1 | 17 | ||
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
angular.module('app').service 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get =... | angular.module('app').service('twitterService', [
'$log',
'$resource',
'messageService',
function($log,
$resource,
messageService) {
var activity,
get,
self;
self = this;
activity = $resource('http://search.twitter.com/search.json',
{
callback: 'JSON_CALLBACK'
},
{
get: {... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 59b669bfc11c566bc6e5abf0b235638d734ae2d9 | 672 | https://github.com/CaryLandholt/AngularFun/blob/59b669bfc11c566bc6e5abf0b235638d734ae2d9/src/scripts/services/twitterService.coffee | 1 | 17 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
angular.module('app').service('twitterService', [
'$log',
'$resource',
'messageService',
function($log,
$resource,
messageService) {
var activity,
get,
self;
self = this;
activity = $resource('http://search.twitter.com/search.json',
{
... | angular.module('app').service 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria, success, failure) ->
activity.get q: criter... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 59b669bfc11c566bc6e5abf0b235638d734ae2d9 | 672 | https://github.com/CaryLandholt/AngularFun/blob/59b669bfc11c566bc6e5abf0b235638d734ae2d9/src/scripts/services/twitterService.coffee | 1 | 17 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:completion | completion | angular.module('app').service 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
self = @
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP' | get = (criteria, success, failure) ->
activity.get q: criteria
, (tweets, getResponseHeaders) ->
messageService.publish 'search', source: 'Twitter', criteria: criteria
success(tweets.results) if angular.isFunction success
, failure
self.get = get
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 59b669bfc11c566bc6e5abf0b235638d734ae2d9 | 672 | https://github.com/CaryLandholt/AngularFun/blob/59b669bfc11c566bc6e5abf0b235638d734ae2d9/src/scripts/services/twitterService.coffee | 1 | 17 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:raw_corpus | raw_corpus | angular.module('app').factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria, success, failure) ->
activity.get q: criteria
, (twe... | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 4fac5cd4104d2b46673cb39a3a7d7034ac103e33 | 672 | https://github.com/CaryLandholt/AngularFun/blob/4fac5cd4104d2b46673cb39a3a7d7034ac103e33/src/scripts/services/twitterService.coffee | 1 | 15 | ||
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
angular.module('app').factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria,... | angular.module('app').factory('twitterService', [
'$log',
'$resource',
'messageService',
function($log,
$resource,
messageService) {
var activity,
get;
activity = $resource('http://search.twitter.com/search.json',
{
callback: 'JSON_CALLBACK'
},
{
get: {
method: 'JSONP'
... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 4fac5cd4104d2b46673cb39a3a7d7034ac103e33 | 672 | https://github.com/CaryLandholt/AngularFun/blob/4fac5cd4104d2b46673cb39a3a7d7034ac103e33/src/scripts/services/twitterService.coffee | 1 | 15 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
angular.module('app').factory('twitterService', [
'$log',
'$resource',
'messageService',
function($log,
$resource,
messageService) {
var activity,
get;
activity = $resource('http://search.twitter.com/search.json',
{
callback: 'JSON_CAL... | angular.module('app').factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria, success, failure) ->
activity.get q: criteria
, (twe... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 4fac5cd4104d2b46673cb39a3a7d7034ac103e33 | 672 | https://github.com/CaryLandholt/AngularFun/blob/4fac5cd4104d2b46673cb39a3a7d7034ac103e33/src/scripts/services/twitterService.coffee | 1 | 15 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:completion | completion | angular.module('app').factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
activity = $resource 'http://search.twitter.com/search.json',
callback: 'JSON_CALLBACK',
get:
method: 'JSONP'
get = (criteria, success, failure) -> | activity.get q: criteria
, (tweets, getResponseHeaders) ->
messageService.publish 'search', source: 'Twitter', criteria: criteria
success(tweets.results) if angular.isFunction success
, failure
{get}
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 4fac5cd4104d2b46673cb39a3a7d7034ac103e33 | 672 | https://github.com/CaryLandholt/AngularFun/blob/4fac5cd4104d2b46673cb39a3a7d7034ac103e33/src/scripts/services/twitterService.coffee | 1 | 15 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:raw_corpus | raw_corpus | ###global define###
define ['libs/angular', 'services/services', 'services/messageService', 'libs/angularResource'], (angular, services) ->
'use strict'
services.factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
activity = $resource 'http://search.twitter.com/s... | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/services/twitterService.coffee | 1 | 20 | ||
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ['libs/angular', 'services/services', 'services/messageService', 'libs/angularResource'], (angular, services) ->
'use strict'
services.factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageServic... | /*global define*/
define(['libs/angular', 'services/services', 'services/messageService', 'libs/angularResource'], function(angular, services) {
'use strict';
return services.factory('twitterService', [
'$log',
'$resource',
'messageService',
function($log,
$resource,
messageService) {
... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/services/twitterService.coffee | 1 | 20 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['libs/angular', 'services/services', 'services/messageService', 'libs/angularResource'], function(angular, services) {
'use strict';
return services.factory('twitterService', [
'$log',
'$resource',
'messageService',
fun... | ###global define###
define ['libs/angular', 'services/services', 'services/messageService', 'libs/angularResource'], (angular, services) ->
'use strict'
services.factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
activity = $resource 'http://search.twitter.com/s... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/services/twitterService.coffee | 1 | 20 |
CaryLandholt/AngularFun:src/scripts/services/twitterService.coffee:1:completion | completion | ###global define###
define ['libs/angular', 'services/services', 'services/messageService', 'libs/angularResource'], (angular, services) ->
'use strict'
services.factory 'twitterService', ['$log', '$resource', 'messageService', ($log, $resource, messageService) ->
activity = $resource 'http://search.twitter.com/s... | get = (criteria, success, failure) ->
activity.get q: criteria
, (tweets, getResponseHeaders) ->
messageService.publish 'search', source: 'Twitter', criteria: criteria
success(tweets.results) if angular.isFunction success
, failure
{get}
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/services/twitterService.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/services/twitterService.coffee | 1 | 20 |
jianliaoim/talk-os:talk-web/client/module/light-image.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'light-image'
propTypes:
onClick: React.PropTypes.func
onLoaded: React.PropTypes.func
src: React.PropTypes.string.isRequired
width: React.PropTypes.number
height: React.PropTypes.number
style: React.PropTypes.object
getDetaultProps: ->
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/light-image.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/light-image.coffee | 6 | 55 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.