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/event.coffee:3:raw_corpus | raw_corpus | # test if we got less items than requested during last request
# if so, we reached to end of the list
return page * perPage == total
, (done) =>
# treat subscribers by packs of 100 with async to prevent from blocking the event loop
# for too long on large subscrib... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 348bd3e8a77369300c20775896045de9af11d8f3 | 1,157 | https://github.com/rs/pushd/blob/348bd3e8a77369300c20775896045de9af11d8f3/lib/event.coffee | 106 | 121 | ||
rs/pushd:lib/event.coffee:3:completion | completion | # test if we got less items than requested during last request
# if so, we reached to end of the list
return page * perPage == total
, (done) =>
# treat subscribers by packs of 100 with async to prevent from blocking the event loop
# for too long on large subscrib... | for id, i in subscriberIdsAndOptions by 2
tasks.push performAction(id, subscriberIdsAndOptions[i + 1])
async.series tasks, =>
total += subscriberIdsAndOptions.length / 2
done()
, =>
# all done
finished(total) if ... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 348bd3e8a77369300c20775896045de9af11d8f3 | 1,157 | https://github.com/rs/pushd/blob/348bd3e8a77369300c20775896045de9af11d8f3/lib/event.coffee | 106 | 121 |
rs/pushd:lib/event.coffee:1:raw_corpus | raw_corpus | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 6 | 55 | ||
rs/pushd:lib/event.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: ... | var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.name)) {
throw new Error('Invalid event name');... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.... | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:1:completion | completion | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | publish: (data, cb) ->
try
payload = new Payload(data)
payload.event = @
catch e
# Invalid payload (empty, missing key or invalid key format)
cb(-1) if cb
return
@redis.sismember "events", @name, (err, exists) =>
if not exi... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:2:raw_corpus | raw_corpus | # action
@pushservices.push(subscriber, subOptions, payload, done)
, (totalSubscribers) =>
# finished
if totalSubscribers > 0
# update some event' stats
@redis.multi()
# account number of sent not... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 56 | 105 | ||
rs/pushd:lib/event.coffee:2:completion | completion | # action
@pushservices.push(subscriber, subOptions, payload, done)
, (totalSubscribers) =>
# finished
if totalSubscribers > 0
# update some event' stats
@redis.multi()
# account number of sent not... | # delete event's info hash
.del(@key)
# remove event from global event list
.srem("events", @name)
.exec ->
cb() if cb
# Performs an action on each subscriber subsribed to this event
forEachSubscribers: (action, finished) ->
... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 56 | 105 |
rs/pushd:lib/event.coffee:3:raw_corpus | raw_corpus | # if so, we reached to end of the list
return page * perPage == total
, (done) =>
# treat subscribers by packs of 100 with async to prevent from blocking the event loop
# for too long on large subscribers lists
@redis.zrange subscribersKey, (page++ * perPage), (pa... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 106 | 120 | ||
rs/pushd:lib/event.coffee:3:completion | completion | # if so, we reached to end of the list
return page * perPage == total
, (done) =>
# treat subscribers by packs of 100 with async to prevent from blocking the event loop
# for too long on large subscribers lists
@redis.zrange subscribersKey, (page++ * perPage), (pa... | for id, i in subscriberIdsAndOptions by 2
tasks.push performAction(id, subscriberIdsAndOptions[i + 1])
async.series tasks, =>
total += subscriberIdsAndOptions.length / 2
done()
, =>
# all done
finished(total) if ... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | c5ce15f5a762801097f8d8e2ddf523be510d3a1f | 1,157 | https://github.com/rs/pushd/blob/c5ce15f5a762801097f8d8e2ddf523be510d3a1f/lib/event.coffee | 106 | 120 |
rs/pushd:lib/event.coffee:1:raw_corpus | raw_corpus | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 6 | 55 | ||
rs/pushd:lib/event.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: ... | var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.name)) {
throw new Error('Invalid event name');... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.... | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:1:completion | completion | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | publish: (data, cb) ->
try
payload = new Payload(data)
payload.event = @
catch e
# Invalid payload (empty, missing key or invalid key format)
cb(-1) if cb
return
@redis.sismember "events", @name, (err, exists) =>
if not exi... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:2:raw_corpus | raw_corpus | # action
@pushservices.push(device, subOptions, payload, done)
, (totalSubscribers) =>
# finished
if totalSubscribers > 0
# update some event' stats
@redis.multi()
# account number of sent notific... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 56 | 105 | ||
rs/pushd:lib/event.coffee:2:completion | completion | # action
@pushservices.push(device, subOptions, payload, done)
, (totalSubscribers) =>
# finished
if totalSubscribers > 0
# update some event' stats
@redis.multi()
# account number of sent notific... | # delete event's info hash
.del(@key)
# remove event from global event list
.srem("events", @name)
.exec ->
cb() if cb
# Performs an action on each device subsribed to this event
forEachSubscribers: (action, finished) ->
... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 56 | 105 |
rs/pushd:lib/event.coffee:3:raw_corpus | raw_corpus | # if so, we reached to end of the list
return page * perPage == total
, (done) =>
# treat subscribers by packs of 100 with async to prevent from blocking the event loop
# for too long on large subscribers lists
@redis.zrange subscribersKey, (page++ * perPage), (pa... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 106 | 120 | ||
rs/pushd:lib/event.coffee:3:completion | completion | # if so, we reached to end of the list
return page * perPage == total
, (done) =>
# treat subscribers by packs of 100 with async to prevent from blocking the event loop
# for too long on large subscribers lists
@redis.zrange subscribersKey, (page++ * perPage), (pa... | for id, i in deviceIdsAndOptions by 2
tasks.push performAction(id, deviceIdsAndOptions[i + 1])
async.series tasks, =>
total += deviceIdsAndOptions.length / 2
done()
, =>
# all done
finished(total) if finished | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 6e013dce036ea96c8e6ba41cb457470c59c5b1df | 1,157 | https://github.com/rs/pushd/blob/6e013dce036ea96c8e6ba41cb457470c59c5b1df/lib/event.coffee | 106 | 120 |
rs/pushd:lib/event.coffee:1:raw_corpus | raw_corpus | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/event.coffee | 6 | 55 | ||
rs/pushd:lib/event.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: ... | var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.name)) {
throw new Error('Invalid event name');... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.... | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:1:completion | completion | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | publish: (data, cb) ->
try
payload = new Payload(data)
payload.event = @
catch e
# Invalid payload (empty, missing key or invalid key format)
cb(-1)
return
@redis.sismember "events", @name, (err, exists) =>
if not exists
... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 92fe686c4bb2787ebc2ddb533e55f548c406c291 | 1,157 | https://github.com/rs/pushd/blob/92fe686c4bb2787ebc2ddb533e55f548c406c291/lib/event.coffee | 6 | 55 |
rs/pushd:lib/event.coffee:1:raw_corpus | raw_corpus | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 5 | 54 | ||
rs/pushd:lib/event.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: ... | var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.name)) {
throw new Error('Invalid event name');... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 5 | 54 |
rs/pushd:lib/event.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.... | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 5 | 54 |
rs/pushd:lib/event.coffee:1:completion | completion | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | publish: (data, cb) ->
payload = new EventPayload(@, data)
@redis.sismember "events", @name, (err, exists) =>
if not exists
cb(0) if cb
return
@forEachSubscribers (device, subOptions, done) =>
# action
@pushservice... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 5 | 54 |
rs/pushd:lib/event.coffee:2:raw_corpus | raw_corpus | @delete =>
cb(0) if cb
delete: (cb) ->
@forEachSubscribers (device, subOptions, done) =>
# action
device.removeSubscription(@, done)
, =>
# finished
@redis.multi()
# delete event's info hash
.del... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 55 | 104 | ||
rs/pushd:lib/event.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@delete =>
cb(0) if cb
delete: (cb) ->
@forEachSubscribers (device, subOptions, done) =>
# action
device.removeSubscription(@, done)
, =>
# finished
@redis.multi()
... | this.delete(() => {
if (cb) {
return cb(0);
}
});
({
delete: function(cb) {
return this.forEachSubscribers((device, subOptions, done) => {
// action
return device.removeSubscription(this, done);
}, () => {
// finished
// delete event's info hash
// remove event from glob... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 55 | 104 |
rs/pushd:lib/event.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.delete(() => {
if (cb) {
return cb(0);
}
});
({
delete: function(cb) {
return this.forEachSubscribers((device, subOptions, done) => {
// action
return device.removeSubscription(this, done);
}, () => {
// finished
// d... | @delete =>
cb(0) if cb
delete: (cb) ->
@forEachSubscribers (device, subOptions, done) =>
# action
device.removeSubscription(@, done)
, =>
# finished
@redis.multi()
# delete event's info hash
.del... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 55 | 104 |
rs/pushd:lib/event.coffee:2:completion | completion | @delete =>
cb(0) if cb
delete: (cb) ->
@forEachSubscribers (device, subOptions, done) =>
# action
device.removeSubscription(@, done)
, =>
# finished
@redis.multi()
# delete event's info hash
.del... | performAction = (deviceId, subOptions) =>
return (done) =>
action(device.getDevice(@redis, deviceId), subOptions, done)
subscribersKey = if @name is 'boardcast' then 'devices' else "#{@key}:devs"
page = 0
perPage = 100
total = 0
async.whilst =... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 55 | 104 |
rs/pushd:lib/event.coffee:3:raw_corpus | raw_corpus | class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lang) and @msg[lang[0..1]]?
return @msg[lang[0..... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 107 | 156 | ||
rs/pushd:lib/event.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lan... | var EventPayload,
hasProp = {}.hasOwnProperty;
EventPayload = (function() {
class EventPayload {
localizedMessage(lang) {
if (this.msg[lang] != null) {
return this.msg[lang];
// Try with lang only in case of full locale code (en_CA)
} else if (EventPayload.prototype.locale_format.test... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 107 | 156 |
rs/pushd:lib/event.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var EventPayload,
hasProp = {}.hasOwnProperty;
EventPayload = (function() {
class EventPayload {
localizedMessage(lang) {
if (this.msg[lang] != null) {
return this.msg[lang];
// Try with lang only in case of full locale code (en_CA)
... | class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lang) and @msg[lang[0..1]]?
return @msg[lang[0..... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 107 | 156 |
rs/pushd:lib/event.coffee:3:completion | completion | class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lang) and @msg[lang[0..1]]?
return @msg[lang[0..... | @msg.default = value
else if key.length > 5 and key.indexOf('msg.') is 0
@msg[key[4..-1]] = value
else if key.length > 6 and key.indexOf('data.') is 0
@data[key[5..-1]] = value
else if key.length > 5 and key.indexOf('var.') is 0
@data[k... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 2b498ab0d138962f972289be3feb52bf4d03c011 | 1,157 | https://github.com/rs/pushd/blob/2b498ab0d138962f972289be3feb52bf4d03c011/lib/event.coffee | 107 | 156 |
rs/pushd:lib/event.coffee:1:raw_corpus | raw_corpus | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 5 | 54 | ||
rs/pushd:lib/event.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: ... | var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.name)) {
throw new Error('Invalid event name');... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 5 | 54 |
rs/pushd:lib/event.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Event,
hasProp = {}.hasOwnProperty;
Event = (function() {
class Event {
constructor(redis, pushservices, name) {
this.redis = redis;
this.pushservices = pushservices;
this.name = name;
if (!Event.prototype.name_format.test(this.... | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 5 | 54 |
rs/pushd:lib/event.coffee:1:completion | completion | class Event
OPTION_IGNORE_MESSAGE: 1
name_format: /^[a-zA-Z0-9:._-]{1,100}$/
constructor: (@redis, @pushservices, @name) ->
throw new Error('Invalid event name') if not Event::name_format.test @name
@key = "event:#{@name}"
info: (cb) ->
return until cb
@redis.multi()
... | publish: (data, cb) ->
payload = new EventPayload(data)
@redis.sismember "events", @name, (err, exists) =>
if not exists
cb(0) if cb
return
@forEachSubscribers (device, subOptions, done) =>
# action
@pushservices.p... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 5 | 54 |
rs/pushd:lib/event.coffee:3:raw_corpus | raw_corpus | class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lang) and @msg[lang[0..1]]?
return @msg[lang[0..... | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 107 | 156 | ||
rs/pushd:lib/event.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lan... | var EventPayload,
hasProp = {}.hasOwnProperty;
EventPayload = (function() {
class EventPayload {
localizedMessage(lang) {
if (this.msg[lang] != null) {
return this.msg[lang];
// Try with lang only in case of full locale code (en_CA)
} else if (EventPayload.prototype.locale_format.test... | CoffeeScript | JavaScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 107 | 156 |
rs/pushd:lib/event.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var EventPayload,
hasProp = {}.hasOwnProperty;
EventPayload = (function() {
class EventPayload {
localizedMessage(lang) {
if (this.msg[lang] != null) {
return this.msg[lang];
// Try with lang only in case of full locale code (en_CA)
... | class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lang) and @msg[lang[0..1]]?
return @msg[lang[0..... | JavaScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 107 | 156 |
rs/pushd:lib/event.coffee:3:completion | completion | class EventPayload
locale_format: /^[a-z]{2}_[A-Z]{2}$/
localizedMessage: (lang) ->
if @msg[lang]?
return @msg[lang]
# Try with lang only in case of full locale code (en_CA)
else if EventPayload::locale_format.test(lang) and @msg[lang[0..1]]?
return @msg[lang[0..... | @msg.default = value
else if key.length > 5 and key.indexOf('msg.') is 0
@msg[key[4..-1]] = value
else if key.length > 6 and key.indexOf('data.') is 0
@data[key[5..-1]] = value
else if key.length > 5 and key.indexOf('var.') is 0
@data[k... | CoffeeScript | CoffeeScript | rs/pushd | lib/event.coffee | MIT | 528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d | 1,157 | https://github.com/rs/pushd/blob/528b1b2a332b9ac8ca2c1a2554944c5eaa35e40d/lib/event.coffee | 107 | 156 |
CaryLandholt/AngularFun:scripts/statuses.coffee:1:raw_corpus | raw_corpus | ###global define###
define ->
'use strict'
200: 'ok'
401: 'unauthorized'
403: 'forbidden' | CoffeeScript | CaryLandholt/AngularFun | scripts/statuses.coffee | MIT | a0fe3a453e28b488b6b711d2110bb1eeb574c8eb | 672 | https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/statuses.coffee | 1 | 8 | ||
CaryLandholt/AngularFun:scripts/statuses.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ->
'use strict'
200: 'ok'
401: 'unauthorized'
403: 'forbidden'
``` | /*global define*/
define(function() {
'use strict';
return {
200: 'ok',
401: 'unauthorized',
403: 'forbidden'
};
}); | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/statuses.coffee | MIT | a0fe3a453e28b488b6b711d2110bb1eeb574c8eb | 672 | https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/statuses.coffee | 1 | 8 |
CaryLandholt/AngularFun:scripts/statuses.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(function() {
'use strict';
return {
200: 'ok',
401: 'unauthorized',
403: 'forbidden'
};
});
``` | ###global define###
define ->
'use strict'
200: 'ok'
401: 'unauthorized'
403: 'forbidden' | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/statuses.coffee | MIT | a0fe3a453e28b488b6b711d2110bb1eeb574c8eb | 672 | https://github.com/CaryLandholt/AngularFun/blob/a0fe3a453e28b488b6b711d2110bb1eeb574c8eb/scripts/statuses.coffee | 1 | 8 |
CaryLandholt/AngularFun:scripts/statuses.coffee:1:raw_corpus | raw_corpus | ###global define###
define ->
'use strict'
200: 'ok'
401: 'unauthorized' | CoffeeScript | CaryLandholt/AngularFun | scripts/statuses.coffee | MIT | 0ae299ec8a05ddbfb2e26f04898245b95f7ab37c | 672 | https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/statuses.coffee | 1 | 7 | ||
CaryLandholt/AngularFun:scripts/statuses.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ->
'use strict'
200: 'ok'
401: 'unauthorized'
``` | /*global define*/
define(function() {
'use strict';
return {
200: 'ok',
401: 'unauthorized'
};
}); | CoffeeScript | JavaScript | CaryLandholt/AngularFun | scripts/statuses.coffee | MIT | 0ae299ec8a05ddbfb2e26f04898245b95f7ab37c | 672 | https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/statuses.coffee | 1 | 7 |
CaryLandholt/AngularFun:scripts/statuses.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(function() {
'use strict';
return {
200: 'ok',
401: 'unauthorized'
};
});
``` | ###global define###
define ->
'use strict'
200: 'ok'
401: 'unauthorized' | JavaScript | CoffeeScript | CaryLandholt/AngularFun | scripts/statuses.coffee | MIT | 0ae299ec8a05ddbfb2e26f04898245b95f7ab37c | 672 | https://github.com/CaryLandholt/AngularFun/blob/0ae299ec8a05ddbfb2e26f04898245b95f7ab37c/scripts/statuses.coffee | 1 | 7 |
mauricemach/zappa:tests/support/tester.coffee:2:raw_corpus | raw_corpus | timeout = (func, time) -> setTimeout time, func
grey = "\033[0;90m"
red = "\033[0;31m"
green = "\033[0;32m"
yellow = "\033[0;33m"
blue = "\033[0;34m"
reset = "\033[0m"
tests = {}
done = {}
uncaught = [] | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 8 | 19 | ||
mauricemach/zappa:tests/support/tester.coffee:2:completion | completion | timeout = (func, time) -> setTimeout time, func
grey = "\033[0;90m"
red = "\033[0;31m"
green = "\033[0;32m"
yellow = "\033[0;33m" | blue = "\033[0;34m"
reset = "\033[0m"
tests = {}
done = {}
uncaught = [] | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 8 | 19 |
mauricemach/zappa:tests/support/tester.coffee:4:raw_corpus | raw_corpus | @add_dir = (dir, cb) =>
fs.readdir dir, (err, files) =>
if err then throw err
else
for f in files
if f.match(/\.coffee$/)
p = path.join dir, f
if p isnt module.parent.filename
@add p
cb() | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 24 | 33 | ||
mauricemach/zappa:tests/support/tester.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@add_dir = (dir, cb) =>
fs.readdir dir, (err, files) =>
if err then throw err
else
for f in files
if f.match(/\.coffee$/)
p = path.join dir, f
if p isnt module.parent.filename
@add p
cb()
``` | this.add_dir = (dir, cb) => {
return fs.readdir(dir, (err, files) => {
var f, i, len, p;
if (err) {
throw err;
} else {
for (i = 0, len = files.length; i < len; i++) {
f = files[i];
if (f.match(/\.coffee$/)) {
p = path.join(dir, f);
if (p !== module.parent.f... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 24 | 33 |
mauricemach/zappa:tests/support/tester.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.add_dir = (dir, cb) => {
return fs.readdir(dir, (err, files) => {
var f, i, len, p;
if (err) {
throw err;
} else {
for (i = 0, len = files.length; i < len; i++) {
f = files[i];
if (f.match(/\.coffee$/)) {
p =... | @add_dir = (dir, cb) =>
fs.readdir dir, (err, files) =>
if err then throw err
else
for f in files
if f.match(/\.coffee$/)
p = path.join dir, f
if p isnt module.parent.filename
@add p
cb() | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 24 | 33 |
mauricemach/zappa:tests/support/tester.coffee:4:completion | completion | @add_dir = (dir, cb) =>
fs.readdir dir, (err, files) =>
if err then throw err
else
for f in files | if f.match(/\.coffee$/)
p = path.join dir, f
if p isnt module.parent.filename
@add p
cb() | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 24 | 33 |
mauricemach/zappa:tests/support/tester.coffee:5:raw_corpus | raw_corpus | @add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_title: full_title
expected: {}
waits: {}
... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 35 | 84 | ||
mauricemach/zappa:tests/support/tester.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_titl... | this.add = function(p) {
var file, ref, results, test, title;
file = path.basename(require.resolve(p));
ref = require(p).tests;
results = [];
for (title in ref) {
test = ref[title];
results.push((function(title, test) {
var full_title;
full_title = file + ': ' + title;
tests[full_tit... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 35 | 84 |
mauricemach/zappa:tests/support/tester.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.add = function(p) {
var file, ref, results, test, title;
file = path.basename(require.resolve(p));
ref = require(p).tests;
results = [];
for (title in ref) {
test = ref[title];
results.push((function(title, test) {
var full_title;
... | @add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_title: full_title
expected: {}
waits: {}
... | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 35 | 84 |
mauricemach/zappa:tests/support/tester.coffee:5:completion | completion | @add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_title: full_title
expected: {}
waits: {}
... | if @expected[key]
delete @expected[key]
@end_check()
reached: -> @pass.apply @, arguments
pass: (key) ->
@passed[key] = true
@_reached key
fail: (key, info = {}) ->
@failed[key] = info
@_reached key
equal: (key, actual, ... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 35 | 84 |
mauricemach/zappa:tests/support/tester.coffee:6:raw_corpus | raw_corpus | expect: ->
@expected[a] = true for a in arguments
wait: (ms) ->
id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true
end_check: ->
if not done[@full_title]
if @ran? and (_(@expected).isEmpty() or _(@waits).isEm... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 85 | 102 | ||
mauricemach/zappa:tests/support/tester.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
expect: ->
@expected[a] = true for a in arguments
wait: (ms) ->
id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true
end_check: ->
if not done[@full_title]
... | ({
expect: function() {
var a, i, len, results;
results = [];
for (i = 0, len = arguments.length; i < len; i++) {
a = arguments[i];
results.push(this.expected[a] = true);
}
return results;
},
wait: function(ms) {
var id;
id = timeout(ms, () => {
delete this.waits[id];... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 85 | 102 |
mauricemach/zappa:tests/support/tester.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
expect: function() {
var a, i, len, results;
results = [];
for (i = 0, len = arguments.length; i < len; i++) {
a = arguments[i];
results.push(this.expected[a] = true);
}
return results;
},
wait: function(ms) {
var id;
... | expect: ->
@expected[a] = true for a in arguments
wait: (ms) ->
id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true
end_check: ->
if not done[@full_title]
if @ran? and (_(@expected).isEmpty() or _(@waits).isEm... | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 85 | 102 |
mauricemach/zappa:tests/support/tester.coffee:6:completion | completion | expect: ->
@expected[a] = true for a in arguments
wait: (ms) ->
id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true | end_check: ->
if not done[@full_title]
if @ran? and (_(@expected).isEmpty() or _(@waits).isEmpty())
@end()
end: ->
clearInterval(k) for k, v of @waits
done[@full_title] = @
finish_him() if _(done).size() is _(tests).size() | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 85 | 102 |
mauricemach/zappa:tests/support/tester.coffee:7:raw_corpus | raw_corpus | @run = ->
for full_title, test of tests
do (full_title, test) ->
t = test.t
try
test(t)
catch e
t.error = e
t.end()
t.ran = yes
t.end_check() | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 104 | 115 | ||
mauricemach/zappa:tests/support/tester.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@run = ->
for full_title, test of tests
do (full_title, test) ->
t = test.t
try
test(t)
catch e
t.error = e
t.end()
t.ran = yes
t.end_check()
``` | this.run = function() {
var full_title, results, test;
results = [];
for (full_title in tests) {
test = tests[full_title];
results.push((function(full_title, test) {
var e, t;
t = test.t;
try {
test(t);
} catch (error) {
e = error;
t.error = e;
t.end... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 104 | 115 |
mauricemach/zappa:tests/support/tester.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.run = function() {
var full_title, results, test;
results = [];
for (full_title in tests) {
test = tests[full_title];
results.push((function(full_title, test) {
var e, t;
t = test.t;
try {
test(t);
} catch (error) ... | @run = ->
for full_title, test of tests
do (full_title, test) ->
t = test.t
try
test(t)
catch e
t.error = e
t.end()
t.ran = yes
t.end_check() | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 104 | 115 |
mauricemach/zappa:tests/support/tester.coffee:7:completion | completion | @run = ->
for full_title, test of tests
do (full_title, test) ->
t = test.t
try
test(t) | catch e
t.error = e
t.end()
t.ran = yes
t.end_check() | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 104 | 115 |
mauricemach/zappa:tests/support/tester.coffee:8:raw_corpus | raw_corpus | finish_him = ->
line = ('-' for i in [1..40]).join('')
log ''
passed = 0
failed = 0
timedout = 0
errors = 0
for full_title, test of tests
do (full_title, test) ->
t = done[full_title]
if not t.all_passed() or t.error
log full_title
log line
for k, v of t.passed
... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 117 | 166 | ||
mauricemach/zappa:tests/support/tester.coffee:8:completion | completion | finish_him = ->
line = ('-' for i in [1..40]).join('')
log ''
passed = 0
failed = 0
timedout = 0
errors = 0
for full_title, test of tests
do (full_title, test) ->
t = done[full_title]
if not t.all_passed() or t.error
log full_title
log line
for k, v of t.passed
... | log red + v.actual + reset
else if v.type is 'matches'
log "Regex vs #{red}actual#{reset}:"
log v.regex
log red + v.actual + reset
for k, v of t.expected
timedout++
log "#{red}✖ #{k} (not reached)#{reset}"
if t.error
errors++
... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 117 | 166 |
mauricemach/zappa:tests/support/tester.coffee:9:raw_corpus | raw_corpus | print "#{green}All passing#{reset} | "
else
print "#{red}#{failed} fail(s)#{reset} | " if failed > 0
print "#{red}#{timedout} not reached#{reset} | " if timedout > 0
print "#{red}#{errors} error(s)#{reset} | " if errors > 0
print "#{red}#{uncaught.length} uncaught error(s)#{reset} | " if uncaught.leng... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 167 | 181 | ||
mauricemach/zappa:tests/support/tester.coffee:9:completion | completion | print "#{green}All passing#{reset} | "
else
print "#{red}#{failed} fail(s)#{reset} | " if failed > 0
print "#{red}#{timedout} not reached#{reset} | " if timedout > 0
print "#{red}#{errors} error(s)#{reset} | " if errors > 0
print "#{red}#{uncaught.length} uncaught error(s)#{reset} | " if uncaught.leng... | print "#{_(tests).size()} tests | "
log "#{new Date - start} ms\n"
process.exit()
process.on 'uncaughtException', (err) ->
uncaught.push err
throw err | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/support/tester.coffee | 167 | 181 |
mauricemach/zappa:tests/support/tester.coffee:5:raw_corpus | raw_corpus | @add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_title: full_title
expected: {}
waits: {}
... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 35 | 84 | ||
mauricemach/zappa:tests/support/tester.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_titl... | this.add = function(p) {
var file, ref, results, test, title;
file = path.basename(require.resolve(p));
ref = require(p).tests;
results = [];
for (title in ref) {
test = ref[title];
results.push((function(title, test) {
var full_title;
full_title = file + ': ' + title;
tests[full_tit... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 35 | 84 |
mauricemach/zappa:tests/support/tester.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.add = function(p) {
var file, ref, results, test, title;
file = path.basename(require.resolve(p));
ref = require(p).tests;
results = [];
for (title in ref) {
test = ref[title];
results.push((function(title, test) {
var full_title;
... | @add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_title: full_title
expected: {}
waits: {}
... | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 35 | 84 |
mauricemach/zappa:tests/support/tester.coffee:5:completion | completion | @add = (p) ->
file = path.basename(require.resolve p)
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
tests[full_title] = test
test.t =
title: title
file: file
full_title: full_title
expected: {}
waits: {}
... | delete @expected[key]
@end_check()
reached: -> @pass.apply @, arguments
pass: (key) ->
@passed[key] = true
@_reached key
fail: (key, info = {}) ->
@failed[key] = info
@_reached key
equal: (key, actual, expected) ->
if actu... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 35 | 84 |
mauricemach/zappa:tests/support/tester.coffee:6:raw_corpus | raw_corpus | id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true
end_check: ->
if not done[@full_title]
if @ran? and (_(@expected).isEmpty() or _(@waits).isEmpty())
@end()
end: ->
clearInterval(k) for k, v of @waits
... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 85 | 98 | ||
mauricemach/zappa:tests/support/tester.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true
end_check: ->
if not done[@full_title]
if @ran? and (_(@expected).isEmpty() or _(@waits).isEmpty())
@end()
... | var id;
id = timeout(ms, () => {
delete this.waits[id];
return this.end_check();
});
this.waits[id] = true;
({
end_check: function() {
if (!done[this.full_title]) {
if ((this.ran != null) && (_(this.expected).isEmpty() || _(this.waits).isEmpty())) {
return this.end();
}
}
},
end... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 85 | 98 |
mauricemach/zappa:tests/support/tester.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var id;
id = timeout(ms, () => {
delete this.waits[id];
return this.end_check();
});
this.waits[id] = true;
({
end_check: function() {
if (!done[this.full_title]) {
if ((this.ran != null) && (_(this.expected).isEmpty() || _(this.waits).isEmpty())... | id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true
end_check: ->
if not done[@full_title]
if @ran? and (_(@expected).isEmpty() or _(@waits).isEmpty())
@end()
end: ->
clearInterval(k) for k, v of @waits
... | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 85 | 98 |
mauricemach/zappa:tests/support/tester.coffee:6:completion | completion | id = timeout ms, =>
delete @waits[id]
@end_check()
@waits[id] = true
end_check: ->
if not done[@full_title] | if @ran? and (_(@expected).isEmpty() or _(@waits).isEmpty())
@end()
end: ->
clearInterval(k) for k, v of @waits
done[@full_title] = @
finish_him() if _(done).size() is _(tests).size() | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 85 | 98 |
mauricemach/zappa:tests/support/tester.coffee:8:raw_corpus | raw_corpus | finish_him = ->
line = ('-' for i in [1..40]).join('')
log ''
passed = 0
failed = 0
timedout = 0
errors = 0
for full_title, test of tests
do (full_title, test) ->
t = done[full_title]
if not t.all_passed() or t.error
log full_title
log line
for k, v of t.passed
... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 113 | 162 | ||
mauricemach/zappa:tests/support/tester.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
finish_him = ->
line = ('-' for i in [1..40]).join('')
log ''
passed = 0
failed = 0
timedout = 0
errors = 0
for full_title, test of tests
do (full_title, test) ->
t = done[full_title]
if not t.all_passed() or t.error
log fu... | var finish_him;
finish_him = function() {
var e, errors, failed, full_title, i, j, len, line, passed, test, timedout;
line = ((function() {
var j, results;
results = [];
for (i = j = 1; j <= 40; i = ++j) {
results.push('-');
}
return results;
})()).join('');
log('');
passed = 0;
f... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 113 | 162 |
mauricemach/zappa:tests/support/tester.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var finish_him;
finish_him = function() {
var e, errors, failed, full_title, i, j, len, line, passed, test, timedout;
line = ((function() {
var j, results;
results = [];
for (i = j = 1; j <= 40; i = ++j) {
results.push('-');
}
return ... | finish_him = ->
line = ('-' for i in [1..40]).join('')
log ''
passed = 0
failed = 0
timedout = 0
errors = 0
for full_title, test of tests
do (full_title, test) ->
t = done[full_title]
if not t.all_passed() or t.error
log full_title
log line
for k, v of t.passed
... | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 113 | 162 |
mauricemach/zappa:tests/support/tester.coffee:8:completion | completion | finish_him = ->
line = ('-' for i in [1..40]).join('')
log ''
passed = 0
failed = 0
timedout = 0
errors = 0
for full_title, test of tests
do (full_title, test) ->
t = done[full_title]
if not t.all_passed() or t.error
log full_title
log line
for k, v of t.passed
... | log red + v.actual + reset
for k, v of t.expected
timedout++
log "#{red}✖ #{k} (not reached)#{reset}"
if t.error
errors++
log "#{red}✖ Error:#{reset}"
log t.error.stack
log ''
if uncaught.length > 0
log "#{uncaught.length} Uncaught error(... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 113 | 162 |
mauricemach/zappa:tests/support/tester.coffee:9:raw_corpus | raw_corpus | print "#{red}#{errors} error(s)#{reset} | " if errors > 0
print "#{red}#{uncaught.length} uncaught error(s)#{reset} | " if uncaught.length > 0
print "#{_(tests).size()} tests | "
log "#{new Date - start} ms\n"
process.exit()
process.on 'uncaughtException', (err) ->
uncaught.push err
throw err | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 163 | 173 | ||
mauricemach/zappa:tests/support/tester.coffee:9:completion | completion | print "#{red}#{errors} error(s)#{reset} | " if errors > 0
print "#{red}#{uncaught.length} uncaught error(s)#{reset} | " if uncaught.length > 0
print "#{_(tests).size()} tests | "
log "#{new Date - start} ms\n" | process.exit()
process.on 'uncaughtException', (err) ->
uncaught.push err
throw err | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | 6a0bf34282a3db50b307b1319d30ff227d4277a9 | 943 | https://github.com/mauricemach/zappa/blob/6a0bf34282a3db50b307b1319d30ff227d4277a9/tests/support/tester.coffee | 163 | 173 |
mauricemach/zappa:tests/support/tester.coffee:1:raw_corpus | raw_corpus | assert = require 'assert'
class Tester
constructor: (zappa, args) ->
@app = zappa.app.apply(zappa, args).app
response: (req, res, name) ->
assert.response @app, req, res, name
get: (url, body, name) ->
assert.response @app, {url}, {body}, name
module.exports = (zappa) ->
(args...) ->
new Tes... | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/support/tester.coffee | 1 | 15 | ||
mauricemach/zappa:tests/support/tester.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
assert = require 'assert'
class Tester
constructor: (zappa, args) ->
@app = zappa.app.apply(zappa, args).app
response: (req, res, name) ->
assert.response @app, req, res, name
get: (url, body, name) ->
assert.response @app, {url}, {body}, nam... | var Tester, assert;
assert = require('assert');
Tester = class Tester {
constructor(zappa, args) {
this.app = zappa.app.apply(zappa, args).app;
}
response(req, res, name) {
return assert.response(this.app, req, res, name);
}
get(url, body, name) {
return assert.response(this.app, {url}, {body}... | CoffeeScript | JavaScript | mauricemach/zappa | tests/support/tester.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/support/tester.coffee | 1 | 15 |
mauricemach/zappa:tests/support/tester.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Tester, assert;
assert = require('assert');
Tester = class Tester {
constructor(zappa, args) {
this.app = zappa.app.apply(zappa, args).app;
}
response(req, res, name) {
return assert.response(this.app, req, res, name);
}
get(url, body, nam... | assert = require 'assert'
class Tester
constructor: (zappa, args) ->
@app = zappa.app.apply(zappa, args).app
response: (req, res, name) ->
assert.response @app, req, res, name
get: (url, body, name) ->
assert.response @app, {url}, {body}, name
module.exports = (zappa) ->
(args...) ->
new Tes... | JavaScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/support/tester.coffee | 1 | 15 |
mauricemach/zappa:tests/support/tester.coffee:1:completion | completion | assert = require 'assert'
class Tester
constructor: (zappa, args) ->
@app = zappa.app.apply(zappa, args).app
response: (req, res, name) -> | assert.response @app, req, res, name
get: (url, body, name) ->
assert.response @app, {url}, {body}, name
module.exports = (zappa) ->
(args...) ->
new Tester(zappa, args) | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/support/tester.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/support/tester.coffee | 1 | 15 |
outsideris/popularconvention:src/service.coffee:1:raw_corpus | raw_corpus | hasLang = (sum, elem) ->
sum.some (el) ->
el.lang is elem.lang | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | 56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a | 730 | https://github.com/outsideris/popularconvention/blob/56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a/src/service.coffee | 150 | 152 | ||
outsideris/popularconvention:src/service.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
hasLang = (sum, elem) ->
sum.some (el) ->
el.lang is elem.lang
``` | var hasLang;
hasLang = function(sum, elem) {
return sum.some(function(el) {
return el.lang === elem.lang;
});
}; | CoffeeScript | JavaScript | outsideris/popularconvention | src/service.coffee | MIT | 56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a | 730 | https://github.com/outsideris/popularconvention/blob/56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a/src/service.coffee | 150 | 152 |
outsideris/popularconvention:src/service.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var hasLang;
hasLang = function(sum, elem) {
return sum.some(function(el) {
return el.lang === elem.lang;
});
};
``` | hasLang = (sum, elem) ->
sum.some (el) ->
el.lang is elem.lang | JavaScript | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | 56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a | 730 | https://github.com/outsideris/popularconvention/blob/56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a/src/service.coffee | 150 | 152 |
outsideris/popularconvention:src/service.coffee:2:raw_corpus | raw_corpus | getConventionByLang = (lang, sum) ->
result = null
sum.forEach (elem) ->
result = elem if elem.lang is lang
result | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | 56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a | 730 | https://github.com/outsideris/popularconvention/blob/56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a/src/service.coffee | 154 | 158 | ||
outsideris/popularconvention:src/service.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getConventionByLang = (lang, sum) ->
result = null
sum.forEach (elem) ->
result = elem if elem.lang is lang
result
``` | var getConventionByLang;
getConventionByLang = function(lang, sum) {
var result;
result = null;
sum.forEach(function(elem) {
if (elem.lang === lang) {
return result = elem;
}
});
return result;
}; | CoffeeScript | JavaScript | outsideris/popularconvention | src/service.coffee | MIT | 56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a | 730 | https://github.com/outsideris/popularconvention/blob/56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a/src/service.coffee | 154 | 158 |
outsideris/popularconvention:src/service.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getConventionByLang;
getConventionByLang = function(lang, sum) {
var result;
result = null;
sum.forEach(function(elem) {
if (elem.lang === lang) {
return result = elem;
}
});
return result;
};
``` | getConventionByLang = (lang, sum) ->
result = null
sum.forEach (elem) ->
result = elem if elem.lang is lang
result | JavaScript | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | 56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a | 730 | https://github.com/outsideris/popularconvention/blob/56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a/src/service.coffee | 154 | 158 |
outsideris/popularconvention:src/service.coffee:2:completion | completion | getConventionByLang = (lang, sum) ->
result = null | sum.forEach (elem) ->
result = elem if elem.lang is lang
result | CoffeeScript | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | 56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a | 730 | https://github.com/outsideris/popularconvention/blob/56dcd43bf639f1542b0c99731ecb6b8d4c9f9a3a/src/service.coffee | 154 | 158 |
outsideris/popularconvention:src/service.coffee:1:raw_corpus | raw_corpus | job = schedule.scheduleJob rule, ->
service.progressTimeline ->
logger "progressTimeline is DONE!!!" | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | 09cc0104552310d72414cf48444fdfca817d07e1 | 730 | https://github.com/outsideris/popularconvention/blob/09cc0104552310d72414cf48444fdfca817d07e1/src/service.coffee | 104 | 106 | ||
outsideris/popularconvention:src/service.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
job = schedule.scheduleJob rule, ->
service.progressTimeline ->
logger "progressTimeline is DONE!!!"
``` | var job;
job = schedule.scheduleJob(rule, function() {
return service.progressTimeline(function() {
return logger("progressTimeline is DONE!!!");
});
}); | CoffeeScript | JavaScript | outsideris/popularconvention | src/service.coffee | MIT | 09cc0104552310d72414cf48444fdfca817d07e1 | 730 | https://github.com/outsideris/popularconvention/blob/09cc0104552310d72414cf48444fdfca817d07e1/src/service.coffee | 104 | 106 |
outsideris/popularconvention:src/service.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var job;
job = schedule.scheduleJob(rule, function() {
return service.progressTimeline(function() {
return logger("progressTimeline is DONE!!!");
});
});
``` | job = schedule.scheduleJob rule, ->
service.progressTimeline ->
logger "progressTimeline is DONE!!!" | JavaScript | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | 09cc0104552310d72414cf48444fdfca817d07e1 | 730 | https://github.com/outsideris/popularconvention/blob/09cc0104552310d72414cf48444fdfca817d07e1/src/service.coffee | 104 | 106 |
outsideris/popularconvention:src/service.coffee:1:raw_corpus | raw_corpus | module.exports =
fetchGithubArchive: (datetime, callback) ->
(http.get "http://data.githubarchive.org/#{datetime}.json.gz", (res) ->
gzip = zlib.createGunzip()
fstream = fs.createWriteStream "#{archiveDir}/#{datetime}.json"
unzip = res.pipe gzip
unzip.pipe fstream
unzip.on 'end', -... | CoffeeScript | outsideris/popularconvention | src/service.coffee | MIT | ff72df2e3db01bf82dc753509a6418c17662cc4f | 730 | https://github.com/outsideris/popularconvention/blob/ff72df2e3db01bf82dc753509a6418c17662cc4f/src/service.coffee | 24 | 73 | ||
outsideris/popularconvention:src/service.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
fetchGithubArchive: (datetime, callback) ->
(http.get "http://data.githubarchive.org/#{datetime}.json.gz", (res) ->
gzip = zlib.createGunzip()
fstream = fs.createWriteStream "#{archiveDir}/#{datetime}.json"
unzip = res.pi... | module.exports = {
fetchGithubArchive: function(datetime, callback) {
return (http.get(`http://data.githubarchive.org/${datetime}.json.gz`, function(res) {
var fstream, gzip, unzip;
gzip = zlib.createGunzip();
fstream = fs.createWriteStream(`${archiveDir}/${datetime}.json`);
unzip = res.pi... | CoffeeScript | JavaScript | outsideris/popularconvention | src/service.coffee | MIT | ff72df2e3db01bf82dc753509a6418c17662cc4f | 730 | https://github.com/outsideris/popularconvention/blob/ff72df2e3db01bf82dc753509a6418c17662cc4f/src/service.coffee | 24 | 73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.