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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kahmali/meteor-restivus:test/authentication_tests.coffee:1:raw_corpus | raw_corpus | describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
AuthApi = new Restivus
apiPath: 'auth/v1'
useAuth: true
auth:
token: 'services.resume.loginTokens.hashedToken'
user: ->
use... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 1 | 39 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
AuthApi = new Restivus
apiPath: 'auth/v1'
useAuth: true
auth:
token: 'services.r... | describe('The default authentication endpoints', function() {
var AuthApi, email, emailLoginToken, password, token, userId, username;
token = null;
emailLoginToken = null;
username = 'test';
email = 'test@ivus.com';
password = 'password';
AuthApi = new Restivus({
apiPath: 'auth/v1',
useAuth: true,... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 1 | 39 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('The default authentication endpoints', function() {
var AuthApi, email, emailLoginToken, password, token, userId, username;
token = null;
emailLoginToken = null;
username = 'test';
email = 'test@ivus.com';
password = 'password';
AuthApi = ne... | describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
AuthApi = new Restivus
apiPath: 'auth/v1'
useAuth: true
auth:
token: 'services.resume.loginTokens.hashedToken'
user: ->
use... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 1 | 39 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:completion | completion | describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
AuthApi = new Restivus
apiPath: 'auth/v1'
useAuth: true
auth:
token: 'services.resume.loginTokens.hashedToken'
user: ->
use... | userId = Accounts.createUser {
username: username
email
password: password
}
it 'should allow a user to login', (test, waitFor) ->
HTTP.post Meteor.absoluteUrl('auth/v1/login'), {
data:
user: username
password: password
}, waitFor (error, result) ->
response = result... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 1 | 39 |
kahmali/meteor-restivus:test/authentication_tests.coffee:2:raw_corpus | raw_corpus | it 'should allow a user to login again, without affecting the first login', (test, waitFor) ->
HTTP.post Meteor.absoluteUrl('auth/v1/login'), {
data:
user: email
password: password
}, waitFor (error, result) ->
response = result.data
test.equal result.statusCode, 200
test... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 41 | 81 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should allow a user to login again, without affecting the first login', (test, waitFor) ->
HTTP.post Meteor.absoluteUrl('auth/v1/login'), {
data:
user: email
password: password
}, waitFor (error, result) ->
response = resul... | it('should allow a user to login again, without affecting the first login', function(test, waitFor) {
return HTTP.post(Meteor.absoluteUrl('auth/v1/login'), {
data: {
user: email,
password: password
}
}, waitFor(function(error, result) {
var emailLoginToken, response;
response = result.da... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 41 | 81 |
kahmali/meteor-restivus:test/authentication_tests.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should allow a user to login again, without affecting the first login', function(test, waitFor) {
return HTTP.post(Meteor.absoluteUrl('auth/v1/login'), {
data: {
user: email,
password: password
}
}, waitFor(function(error, result) {
... | it 'should allow a user to login again, without affecting the first login', (test, waitFor) ->
HTTP.post Meteor.absoluteUrl('auth/v1/login'), {
data:
user: email
password: password
}, waitFor (error, result) ->
response = result.data
test.equal result.statusCode, 200
test... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 41 | 81 |
kahmali/meteor-restivus:test/authentication_tests.coffee:2:completion | completion | it 'should allow a user to login again, without affecting the first login', (test, waitFor) ->
HTTP.post Meteor.absoluteUrl('auth/v1/login'), {
data:
user: email
password: password
}, waitFor (error, result) ->
response = result.data
test.equal result.statusCode, 200
test... | HTTP.post Meteor.absoluteUrl('auth/v1/login'), {
data:
user: username
password: "NotAllowed"
}, waitFor (error, result) ->
response = result.data
test.equal result.statusCode, 401
test.equal response.status, 'error'
durationInMilliseconds = new Date() - startTime
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 41 | 81 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:raw_corpus | raw_corpus | it 'should remove the logout token after logging out and should respond after 500 msec', (test, waitFor) ->
AuthApi.addRoute 'prevent-access-after-logout', {authRequired: true},
get: -> true
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
startTime = ... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 84 | 109 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should remove the logout token after logging out and should respond after 500 msec', (test, waitFor) ->
AuthApi.addRoute 'prevent-access-after-logout', {authRequired: true},
get: -> true
# This test should take 500 msec or more. To speed up test... | it('should remove the logout token after logging out and should respond after 500 msec', function(test, waitFor) {
var startTime;
AuthApi.addRoute('prevent-access-after-logout', {
authRequired: true
}, {
get: function() {
return true;
}
});
// This test should take 500 msec or more. To speed... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 84 | 109 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should remove the logout token after logging out and should respond after 500 msec', function(test, waitFor) {
var startTime;
AuthApi.addRoute('prevent-access-after-logout', {
authRequired: true
}, {
get: function() {
return true;
}
})... | it 'should remove the logout token after logging out and should respond after 500 msec', (test, waitFor) ->
AuthApi.addRoute 'prevent-access-after-logout', {authRequired: true},
get: -> true
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
startTime = ... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 84 | 109 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:completion | completion | it 'should remove the logout token after logging out and should respond after 500 msec', (test, waitFor) ->
AuthApi.addRoute 'prevent-access-after-logout', {authRequired: true},
get: -> true
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
startTime = ... | test.equal response.status, 'error'
durationInMilliseconds = new Date() - startTime
test.isTrue durationInMilliseconds >= 500
it 'should allow a second logged in user to logout', (test, waitFor) ->
HTTP.get Meteor.absoluteUrl('auth/v1/logout'), {
headers:
'X-User-Id': userId
'X-... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | a95178c9c3f6c87ff65729d9f491dd4ca2132a20 | 541 | https://github.com/kahmali/meteor-restivus/blob/a95178c9c3f6c87ff65729d9f491dd4ca2132a20/test/authentication_tests.coffee | 84 | 109 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:raw_corpus | raw_corpus | Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.remove username: username
userId = Accounts.createUse... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 1 | 45 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.r... | Meteor.startup(function() {
return describe('The default authentication endpoints', function() {
var email, emailLoginToken, password, token, userId, username;
token = null;
emailLoginToken = null;
username = 'test';
email = 'test@ivus.com';
password = 'password';
// Delete the test accoun... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 1 | 45 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Meteor.startup(function() {
return describe('The default authentication endpoints', function() {
var email, emailLoginToken, password, token, userId, username;
token = null;
emailLoginToken = null;
username = 'test';
email = 'test@ivus.com';
... | Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.remove username: username
userId = Accounts.createUse... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 1 | 45 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:completion | completion | Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.remove username: username
userId = Accounts.createUse... | }, waitFor (error, result) ->
response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success'
test.equal response.data.userId, userId
test.isTrue response.data.authToken
# Store the token for later use
token = response... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 1 | 45 |
kahmali/meteor-restivus:test/authentication_tests.coffee:2:raw_corpus | raw_corpus | # Store the token for later use
emailLoginToken = response.data.authToken
it 'should not allow a user with wrong password to login and should respond after 500 msec', (test, waitFor) ->
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
startTime... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 47 | 91 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:2:completion | completion | # Store the token for later use
emailLoginToken = response.data.authToken
it 'should not allow a user with wrong password to login and should respond after 500 msec', (test, waitFor) ->
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
startTime... | 'X-User-Id': userId
'X-Auth-Token': token
}, waitFor (error, result) ->
response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success'
it 'should remove the logout token after logging out and should respond after 500 msec', (test... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 47 | 91 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:raw_corpus | raw_corpus | it 'should allow a second logged in user to logout', (test, waitFor) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId
'X-Auth-Token': emailLoginToken
}, waitFor (error, result) ->
response = JSON.parse result.content
test.equal resu... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 93 | 101 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should allow a second logged in user to logout', (test, waitFor) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId
'X-Auth-Token': emailLoginToken
}, waitFor (error, result) ->
res... | it('should allow a second logged in user to logout', function(test, waitFor) {
return HTTP.get(Meteor.absoluteUrl('/api/v1/logout'), {
headers: {
'X-User-Id': userId,
'X-Auth-Token': emailLoginToken
}
}, waitFor(function(error, result) {
var response;
response = JSON.parse(result.content... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 93 | 101 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should allow a second logged in user to logout', function(test, waitFor) {
return HTTP.get(Meteor.absoluteUrl('/api/v1/logout'), {
headers: {
'X-User-Id': userId,
'X-Auth-Token': emailLoginToken
}
}, waitFor(function(error, result) {
... | it 'should allow a second logged in user to logout', (test, waitFor) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId
'X-Auth-Token': emailLoginToken
}, waitFor (error, result) ->
response = JSON.parse result.content
test.equal resu... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 93 | 101 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:completion | completion | it 'should allow a second logged in user to logout', (test, waitFor) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId | 'X-Auth-Token': emailLoginToken
}, waitFor (error, result) ->
response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success' | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fb35e931dfbc59851480ce4d66d6ae348b2e3f18 | 541 | https://github.com/kahmali/meteor-restivus/blob/fb35e931dfbc59851480ce4d66d6ae348b2e3f18/test/authentication_tests.coffee | 93 | 101 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:raw_corpus | raw_corpus | Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.remove username: username
userId = Accounts.createUse... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 1 | 46 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.r... | Meteor.startup(function() {
return describe('The default authentication endpoints', function() {
var email, emailLoginToken, password, token, userId, username;
token = null;
emailLoginToken = null;
username = 'test';
email = 'test@ivus.com';
password = 'password';
// Delete the test accoun... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 1 | 46 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Meteor.startup(function() {
return describe('The default authentication endpoints', function() {
var email, emailLoginToken, password, token, userId, username;
token = null;
emailLoginToken = null;
username = 'test';
email = 'test@ivus.com';
... | Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.remove username: username
userId = Accounts.createUse... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 1 | 46 |
kahmali/meteor-restivus:test/authentication_tests.coffee:1:completion | completion | Meteor.startup ->
describe 'The default authentication endpoints', ->
token = null
emailLoginToken = null
username = 'test'
email = 'test@ivus.com'
password = 'password'
# Delete the test account if it's still present
Meteor.users.remove username: username
userId = Accounts.createUse... | response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success'
test.equal response.data.userId, userId
test.isTrue response.data.authToken
# Store the token for later use
token = response.data.authToken
next()
i... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 1 | 46 |
kahmali/meteor-restivus:test/authentication_tests.coffee:2:raw_corpus | raw_corpus | # Store the token for later use
emailLoginToken = response.data.authToken
next()
it 'should not allow a user with wrong password to login and should respond after 500 msec', (test, next) ->
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 48 | 96 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:2:completion | completion | # Store the token for later use
emailLoginToken = response.data.authToken
next()
it 'should not allow a user with wrong password to login and should respond after 500 msec', (test, next) ->
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
... | 'X-User-Id': userId
'X-Auth-Token': token
}, (error, result) ->
response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success'
next()
it 'should remove the logout token after logging out and should respond after 500 msec'... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 48 | 96 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:raw_corpus | raw_corpus | it 'should allow a second logged in user to logout', (test, next) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId
'X-Auth-Token': emailLoginToken
}, (error, result) ->
response = JSON.parse result.content
test.equal result.statusCo... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 98 | 107 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should allow a second logged in user to logout', (test, next) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId
'X-Auth-Token': emailLoginToken
}, (error, result) ->
response = JSO... | it('should allow a second logged in user to logout', function(test, next) {
return HTTP.get(Meteor.absoluteUrl('/api/v1/logout'), {
headers: {
'X-User-Id': userId,
'X-Auth-Token': emailLoginToken
}
}, function(error, result) {
var response;
response = JSON.parse(result.content);
test... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 98 | 107 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should allow a second logged in user to logout', function(test, next) {
return HTTP.get(Meteor.absoluteUrl('/api/v1/logout'), {
headers: {
'X-User-Id': userId,
'X-Auth-Token': emailLoginToken
}
}, function(error, result) {
var respon... | it 'should allow a second logged in user to logout', (test, next) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId
'X-Auth-Token': emailLoginToken
}, (error, result) ->
response = JSON.parse result.content
test.equal result.statusCo... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 98 | 107 |
kahmali/meteor-restivus:test/authentication_tests.coffee:3:completion | completion | it 'should allow a second logged in user to logout', (test, next) ->
HTTP.get Meteor.absoluteUrl('/api/v1/logout'), {
headers:
'X-User-Id': userId
'X-Auth-Token': emailLoginToken | }, (error, result) ->
response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success'
next() | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | fc451572ef5ca62cde4bc5edee1e557f0603e6b6 | 541 | https://github.com/kahmali/meteor-restivus/blob/fc451572ef5ca62cde4bc5edee1e557f0603e6b6/test/authentication_tests.coffee | 98 | 107 |
kahmali/meteor-restivus:test/authentication_tests.coffee:2:raw_corpus | raw_corpus | # Store the token for later use
emailLoginToken = response.data.authToken
next()
it 'should not allow a user with wrong password to login and should respond after 500 msec', (test, next) ->
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | 8fe7e6f23c556e06f630619aa1e8e74b6ec870ca | 541 | https://github.com/kahmali/meteor-restivus/blob/8fe7e6f23c556e06f630619aa1e8e74b6ec870ca/test/authentication_tests.coffee | 48 | 96 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:2:completion | completion | # Store the token for later use
emailLoginToken = response.data.authToken
next()
it 'should not allow a user with wrong password to login and should respond after 500 msec', (test, next) ->
# This test should take 500 msec or more. To speed up testing, these two tests have been combined.
... | 'X-User-Id': userId
'X-Auth-Token': token
}, (error, result) ->
response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success'
next()
it 'should remove the logout token after logging out and should respond after 500 msec'... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | 8fe7e6f23c556e06f630619aa1e8e74b6ec870ca | 541 | https://github.com/kahmali/meteor-restivus/blob/8fe7e6f23c556e06f630619aa1e8e74b6ec870ca/test/authentication_tests.coffee | 48 | 96 |
kahmali/meteor-restivus:test/authentication_tests.coffee:2:raw_corpus | raw_corpus | # Store the token for later use
emailLoginToken = response.data.authToken
next()
it 'should not allow a user with wrong password to login', (test, next) ->
HTTP.post Meteor.absoluteUrl('/api/v1/login'), {
data:
user: username
password: "NotAllowed"
}, (error... | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | 27f885b12b32f43da9499daaa4c3836138f0ab9e | 541 | https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/test/authentication_tests.coffee | 48 | 89 | ||
kahmali/meteor-restivus:test/authentication_tests.coffee:2:completion | completion | # Store the token for later use
emailLoginToken = response.data.authToken
next()
it 'should not allow a user with wrong password to login', (test, next) ->
HTTP.post Meteor.absoluteUrl('/api/v1/login'), {
data:
user: username
password: "NotAllowed"
}, (error... | 'X-Auth-Token': token
}, (error, result) ->
response = JSON.parse result.content
test.equal result.statusCode, 200
test.equal response.status, 'success'
next()
it 'should remove the logout token after logging out', (test, next) ->
Restivus.addRoute 'prevent-access-after-... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/authentication_tests.coffee | MIT | 27f885b12b32f43da9499daaa4c3836138f0ab9e | 541 | https://github.com/kahmali/meteor-restivus/blob/27f885b12b32f43da9499daaa4c3836138f0ab9e/test/authentication_tests.coffee | 48 | 89 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:1:raw_corpus | raw_corpus | exports.run: ->
parse_options()
return usage() if options.help
return version() if options.version
return require './repl' if options.interactive
return compile_stdio() if options.stdio
return compile_script 'co... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 47 | 65 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:1:completion | completion | exports.run: ->
parse_options()
return usage() if options.help
return version() if options.version
return require './repl' if options.interactive
return compile_stdio() if options.stdio
return compile_script 'co... | flags: []
if separator >= 0
flags: sources[(separator + 1)...sources.length]
sources: sources[0...separator]
process.ARGV: process.argv: flags
compile_scripts()
# Asynchronously read in each CoffeeScript in a list of source files and
# compile them. If a directory is passed, recursively compile all sourc... | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 47 | 65 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:2:raw_corpus | raw_corpus | compile_scripts: ->
for source in sources
base: source
compile: (source) ->
path.exists source, (exists) ->
throw new Error "File not found: $source" unless exists
fs.stat source, (err, stats) ->
if stats.isDirectory()
fs.readdir source, (err, files) ->
... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 66 | 84 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
compile_scripts: ->
for source in sources
base: source
compile: (source) ->
path.exists source, (exists) ->
throw new Error "File not found: $source" unless exists
fs.stat source, (err, stats) ->
if stats.isDirectory()
... | ({
compile_scripts: function() {
var i, len, results, source;
results = [];
for (i = 0, len = sources.length; i < len; i++) {
source = sources[i];
({
base: source,
compile: function(source) {
return path.exists(source, function(exists) {
if (!exists) {
... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 66 | 84 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
compile_scripts: function() {
var i, len, results, source;
results = [];
for (i = 0, len = sources.length; i < len; i++) {
source = sources[i];
({
base: source,
compile: function(source) {
return path.exists(so... | compile_scripts: ->
for source in sources
base: source
compile: (source) ->
path.exists source, (exists) ->
throw new Error "File not found: $source" unless exists
fs.stat source, (err, stats) ->
if stats.isDirectory()
fs.readdir source, (err, files) ->
... | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 66 | 84 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:2:completion | completion | compile_scripts: ->
for source in sources
base: source
compile: (source) ->
path.exists source, (exists) ->
throw new Error "File not found: $source" unless exists
fs.stat source, (err, stats) ->
if stats.isDirectory()
fs.readdir source, (err, files) -> | for file in files
compile path.join(source, file)
else if path.extname(source) is '.coffee'
fs.readFile source, (err, code) -> compile_script(source, code.toString(), base)
watch source, base if options.watch
compile source
# Compile a single source script, contain... | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 66 | 84 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:3:raw_corpus | raw_corpus | compile_script: (source, code, base) ->
o: options
code_opts: compile_options source
try
if o.tokens then print_tokens CoffeeScript.tokens code
else if o.nodes then puts CoffeeScript.nodes(code).toString()
else if o.run then CoffeeScript.run code, code_opts
else
js: C... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 85 | 101 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
compile_script: (source, code, base) ->
o: options
code_opts: compile_options source
try
if o.tokens then print_tokens CoffeeScript.tokens code
else if o.nodes then puts CoffeeScript.nodes(code).toString()
else if o.run t... | ({
compile_script: function(source, code, base) {
var err;
({
o: options,
code_opts: compile_options(source)
});
try {
if (o.tokens) {
return print_tokens(CoffeeScript.tokens(code));
} else if (o.nodes) {
return puts(CoffeeScript.nodes(code).toString());
}... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 85 | 101 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
compile_script: function(source, code, base) {
var err;
({
o: options,
code_opts: compile_options(source)
});
try {
if (o.tokens) {
return print_tokens(CoffeeScript.tokens(code));
} else if (o.nodes) {
re... | compile_script: (source, code, base) ->
o: options
code_opts: compile_options source
try
if o.tokens then print_tokens CoffeeScript.tokens code
else if o.nodes then puts CoffeeScript.nodes(code).toString()
else if o.run then CoffeeScript.run code, code_opts
else
js: C... | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 85 | 101 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:3:completion | completion | compile_script: (source, code, base) ->
o: options
code_opts: compile_options source
try
if o.tokens then print_tokens CoffeeScript.tokens code
else if o.nodes then puts CoffeeScript.nodes(code).toString()
else if o.run then CoffeeScript.run code, code_opts
else | js: CoffeeScript.compile code, code_opts
if o.print then print js
else if o.compile then write_js source, js, base
else if o.lint then lint js
catch err
if o.watch then puts err.message else throw err
# Attach the appropriate listeners to compile scripts incoming over... | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 85 | 101 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:4:raw_corpus | raw_corpus | compile_stdio: ->
code: ''
stdin: process.openStdin()
stdin.addListener 'data', (buffer) ->
code: + buffer.toString() if buffer
stdin.addListener 'end', ->
compile_script 'stdio', code
# Watch a source CoffeeScript file using `fs.watchFile`, recompiling it every
# time the file is updated. May be used ... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 102 | 112 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
compile_stdio: ->
code: ''
stdin: process.openStdin()
stdin.addListener 'data', (buffer) ->
code: + buffer.toString() if buffer
stdin.addListener 'end', ->
compile_script 'stdio', code
# Watch a source CoffeeScript file using `fs.watchFile`, reco... | ({
compile_stdio: function() {
({
code: '',
stdin: process.openStdin()
});
stdin.addListener('data', function(buffer) {
if (buffer) {
return {
code: +buffer.toString()
};
}
});
return stdin.addListener('end', function() {
return compile_scrip... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 102 | 112 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
compile_stdio: function() {
({
code: '',
stdin: process.openStdin()
});
stdin.addListener('data', function(buffer) {
if (buffer) {
return {
code: +buffer.toString()
};
}
});
return stdin.add... | compile_stdio: ->
code: ''
stdin: process.openStdin()
stdin.addListener 'data', (buffer) ->
code: + buffer.toString() if buffer
stdin.addListener 'end', ->
compile_script 'stdio', code
# Watch a source CoffeeScript file using `fs.watchFile`, recompiling it every
# time the file is updated. May be used ... | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 102 | 112 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:4:completion | completion | compile_stdio: ->
code: ''
stdin: process.openStdin()
stdin.addListener 'data', (buffer) ->
code: + buffer.toString() if buffer | stdin.addListener 'end', ->
compile_script 'stdio', code
# Watch a source CoffeeScript file using `fs.watchFile`, recompiling it every
# time the file is updated. May be used in combination with other options,
# such as `--lint` or `--print`. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 102 | 112 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:5:raw_corpus | raw_corpus | watch: (source, base) ->
fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.mtime.getTime() is prev.mtime.getTime()
puts "Compiled $source" if options.compile
fs.readFile source, (err, code) -> compile_script(source, code.toString(), base)
# Write out a JavaScript sour... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 113 | 121 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
watch: (source, base) ->
fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.mtime.getTime() is prev.mtime.getTime()
puts "Compiled $source" if options.compile
fs.readFile source, (err, code) -> compile_script(sour... | ({
watch: function(source, base) {
return fs.watchFile(source, {
persistent: true,
interval: 500
}, function(curr, prev) {
if (curr.mtime.getTime() === prev.mtime.getTime()) {
return;
}
if (options.compile) {
puts("Compiled $source");
}
return fs.readF... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 113 | 121 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
watch: function(source, base) {
return fs.watchFile(source, {
persistent: true,
interval: 500
}, function(curr, prev) {
if (curr.mtime.getTime() === prev.mtime.getTime()) {
return;
}
if (options.compile) {
... | watch: (source, base) ->
fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.mtime.getTime() is prev.mtime.getTime()
puts "Compiled $source" if options.compile
fs.readFile source, (err, code) -> compile_script(source, code.toString(), base)
# Write out a JavaScript sour... | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 113 | 121 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:5:completion | completion | watch: (source, base) ->
fs.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.mtime.getTime() is prev.mtime.getTime()
puts "Compiled $source" if options.compile | fs.readFile source, (err, code) -> compile_script(source, code.toString(), base)
# Write out a JavaScript source file with the compiled code. By default, files
# are written out in `cwd` as `.js` files with the same name, but the output
# directory can be customized with `--output`. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 113 | 121 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:6:raw_corpus | raw_corpus | write_js: (source, js, base) ->
filename: path.basename(source, path.extname(source)) + '.js'
src_dir: path.dirname source
base_dir: src_dir.substring base.length
dir: if options.output then path.join options.output, base_dir else src_dir
js_path: path.join dir, filename
compile: -> fs.writeFile js_... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 122 | 133 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
write_js: (source, js, base) ->
filename: path.basename(source, path.extname(source)) + '.js'
src_dir: path.dirname source
base_dir: src_dir.substring base.length
dir: if options.output then path.join options.output, base_dir else src_dir
js_path:... | ({
write_js: function(source, js, base) {
({
filename: path.basename(source, path.extname(source)) + '.js',
src_dir: path.dirname(source),
base_dir: src_dir.substring(base.length),
dir: options.output ? path.join(options.output, base_dir) : src_dir,
js_path: path.join(dir, filename),... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 122 | 133 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
write_js: function(source, js, base) {
({
filename: path.basename(source, path.extname(source)) + '.js',
src_dir: path.dirname(source),
base_dir: src_dir.substring(base.length),
dir: options.output ? path.join(options.output, base_d... | write_js: (source, js, base) ->
filename: path.basename(source, path.extname(source)) + '.js'
src_dir: path.dirname source
base_dir: src_dir.substring base.length
dir: if options.output then path.join options.output, base_dir else src_dir
js_path: path.join dir, filename
compile: -> fs.writeFile js_... | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 122 | 133 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:6:completion | completion | write_js: (source, js, base) ->
filename: path.basename(source, path.extname(source)) + '.js'
src_dir: path.dirname source
base_dir: src_dir.substring base.length
dir: if options.output then path.join options.output, base_dir else src_dir
js_path: path.join dir, filename | compile: -> fs.writeFile js_path, js
path.exists dir, (exists) ->
if exists then compile() else exec "mkdir -p $dir", compile
# Pipe compiled JS through JSLint (requires a working `jsl` command), printing
# any errors or warnings that arise. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 122 | 133 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:7:raw_corpus | raw_corpus | lint: (js) ->
print_it: (buffer) -> print buffer.toString()
jsl: spawn 'jsl', ['-nologo', '-stdin']
jsl.stdout.addListener 'data', print_it
jsl.stderr.addListener 'data', print_it
jsl.stdin.write js
jsl.stdin.end()
# Pretty-print a stream of tokens. | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 134 | 142 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
lint: (js) ->
print_it: (buffer) -> print buffer.toString()
jsl: spawn 'jsl', ['-nologo', '-stdin']
jsl.stdout.addListener 'data', print_it
jsl.stderr.addListener 'data', print_it
jsl.stdin.write js
jsl.stdin.end()
# Pretty-print a stream of tokens.
... | ({
lint: function(js) {
({
print_it: function(buffer) {
return print(buffer.toString());
},
jsl: spawn('jsl', ['-nologo', '-stdin'])
});
jsl.stdout.addListener('data', print_it);
jsl.stderr.addListener('data', print_it);
jsl.stdin.write(js);
return jsl.stdin.end();
... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 134 | 142 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
lint: function(js) {
({
print_it: function(buffer) {
return print(buffer.toString());
},
jsl: spawn('jsl', ['-nologo', '-stdin'])
});
jsl.stdout.addListener('data', print_it);
jsl.stderr.addListener('data', print_it);
... | lint: (js) ->
print_it: (buffer) -> print buffer.toString()
jsl: spawn 'jsl', ['-nologo', '-stdin']
jsl.stdout.addListener 'data', print_it
jsl.stderr.addListener 'data', print_it
jsl.stdin.write js
jsl.stdin.end()
# Pretty-print a stream of tokens. | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 134 | 142 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:7:completion | completion | lint: (js) ->
print_it: (buffer) -> print buffer.toString()
jsl: spawn 'jsl', ['-nologo', '-stdin']
jsl.stdout.addListener 'data', print_it | jsl.stderr.addListener 'data', print_it
jsl.stdin.write js
jsl.stdin.end()
# Pretty-print a stream of tokens. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 134 | 142 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:8:raw_corpus | raw_corpus | print_tokens: (tokens) ->
strings: for token in tokens
[tag, value]: [token[0], token[1].toString().replace(/\n/, '\\n')]
"[$tag $value]"
puts strings.join(' ')
# Use the [OptionParser module](optparse.html) to extract all options from
# `process.argv` that are specified in `SWITCHES`. | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 143 | 150 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:8:completion | completion | print_tokens: (tokens) ->
strings: for token in tokens
[tag, value]: [token[0], token[1].toString().replace(/\n/, '\\n')]
"[$tag $value]" | puts strings.join(' ')
# Use the [OptionParser module](optparse.html) to extract all options from
# `process.argv` that are specified in `SWITCHES`. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 143 | 150 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:9:raw_corpus | raw_corpus | parse_options: ->
option_parser: new optparse.OptionParser SWITCHES, BANNER
o: options: option_parser.parse(process.argv)
options.run: not (o.compile or o.print or o.lint)
options.print: !! (o.print or (o.eval or o.stdio and o.compile))
sources: options.arguments[2...options.arguments.length]
# T... | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 151 | 158 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:9:completion | completion | parse_options: ->
option_parser: new optparse.OptionParser SWITCHES, BANNER
o: options: option_parser.parse(process.argv)
options.run: not (o.compile or o.print or o.lint) | options.print: !! (o.print or (o.eval or o.stdio and o.compile))
sources: options.arguments[2...options.arguments.length]
# The compile-time options to pass to the CoffeeScript compiler. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 151 | 158 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:10:raw_corpus | raw_corpus | compile_options: (source) ->
o: {source: source}
o['no_wrap']: options['no-wrap']
o
# Print the `--help` usage message and exit. | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 159 | 164 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:10:completion | completion | compile_options: (source) ->
o: {source: source}
o['no_wrap']: options['no-wrap'] | o
# Print the `--help` usage message and exit. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 159 | 164 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:11:raw_corpus | raw_corpus | usage: ->
puts option_parser.help()
process.exit 0
# Print the `--version` message and exit. | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 165 | 169 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
usage: ->
puts option_parser.help()
process.exit 0
# Print the `--version` message and exit.
``` | ({
usage: function() {
puts(option_parser.help());
return process.exit(0);
}
});
// Print the `--version` message and exit. | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 165 | 169 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
usage: function() {
puts(option_parser.help());
return process.exit(0);
}
});
// Print the `--version` message and exit.
``` | usage: ->
puts option_parser.help()
process.exit 0
# Print the `--version` message and exit. | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 165 | 169 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:11:completion | completion | usage: ->
puts option_parser.help() | process.exit 0
# Print the `--version` message and exit. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 165 | 169 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:12:raw_corpus | raw_corpus | version: ->
puts "CoffeeScript version $CoffeeScript.VERSION"
process.exit 0 | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 170 | 172 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:12:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
version: ->
puts "CoffeeScript version $CoffeeScript.VERSION"
process.exit 0
``` | ({
version: function() {
puts("CoffeeScript version $CoffeeScript.VERSION");
return process.exit(0);
}
}); | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 170 | 172 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/src/command.coffee:12:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
version: function() {
puts("CoffeeScript version $CoffeeScript.VERSION");
return process.exit(0);
}
});
``` | version: ->
puts "CoffeeScript version $CoffeeScript.VERSION"
process.exit 0 | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/src/command.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/src/command.coffee | 170 | 172 |
mojotech/pioneer:test/steps/util.coffee:1:raw_corpus | raw_corpus | Path = require "path"
fixturesBase = Path.resolve(__dirname, "../", "fixtures")
module.exports = ->
@When /^I view "([^"]*)"$/, (name) ->
@driver.get("file:///"+ Path.join(fixturesBase, name)) | CoffeeScript | mojotech/pioneer | test/steps/util.coffee | MIT | 1c77ffb13f5e3b88d62950430bbb7944dd341df0 | 523 | https://github.com/mojotech/pioneer/blob/1c77ffb13f5e3b88d62950430bbb7944dd341df0/test/steps/util.coffee | 1 | 6 | ||
mojotech/pioneer:test/steps/util.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Path = require "path"
fixturesBase = Path.resolve(__dirname, "../", "fixtures")
module.exports = ->
@When /^I view "([^"]*)"$/, (name) ->
@driver.get("file:///"+ Path.join(fixturesBase, name))
``` | var Path, fixturesBase;
Path = require("path");
fixturesBase = Path.resolve(__dirname, "../", "fixtures");
module.exports = function() {
return this.When(/^I view "([^"]*)"$/, function(name) {
return this.driver.get("file:///" + Path.join(fixturesBase, name));
});
}; | CoffeeScript | JavaScript | mojotech/pioneer | test/steps/util.coffee | MIT | 1c77ffb13f5e3b88d62950430bbb7944dd341df0 | 523 | https://github.com/mojotech/pioneer/blob/1c77ffb13f5e3b88d62950430bbb7944dd341df0/test/steps/util.coffee | 1 | 6 |
mojotech/pioneer:test/steps/util.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Path, fixturesBase;
Path = require("path");
fixturesBase = Path.resolve(__dirname, "../", "fixtures");
module.exports = function() {
return this.When(/^I view "([^"]*)"$/, function(name) {
return this.driver.get("file:///" + Path.join(fixturesBase, nam... | Path = require "path"
fixturesBase = Path.resolve(__dirname, "../", "fixtures")
module.exports = ->
@When /^I view "([^"]*)"$/, (name) ->
@driver.get("file:///"+ Path.join(fixturesBase, name)) | JavaScript | CoffeeScript | mojotech/pioneer | test/steps/util.coffee | MIT | 1c77ffb13f5e3b88d62950430bbb7944dd341df0 | 523 | https://github.com/mojotech/pioneer/blob/1c77ffb13f5e3b88d62950430bbb7944dd341df0/test/steps/util.coffee | 1 | 6 |
mojotech/pioneer:test/steps/util.coffee:1:completion | completion | Path = require "path"
fixturesBase = Path.resolve(__dirname, "../", "fixtures") | module.exports = ->
@When /^I view "([^"]*)"$/, (name) ->
@driver.get("file:///"+ Path.join(fixturesBase, name)) | CoffeeScript | CoffeeScript | mojotech/pioneer | test/steps/util.coffee | MIT | 1c77ffb13f5e3b88d62950430bbb7944dd341df0 | 523 | https://github.com/mojotech/pioneer/blob/1c77ffb13f5e3b88d62950430bbb7944dd341df0/test/steps/util.coffee | 1 | 6 |
oozcitak/xmlbuilder-js:test/basic/prettyattributes.coffee:1:raw_corpus | raw_corpus | suite 'Creating XML with string writer:', ->
test 'Pretty print attributes - 1', ->
eq(
xml('test', { headless: true })
.ele('node', {"first":"1", "second":"2"})
.end({ pretty: true, width: 20 })
"""
<test>
<node first="1"
second="2"/>
</test>
"""
... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/prettyattributes.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/prettyattributes.coffee | 1 | 50 | ||
oozcitak/xmlbuilder-js:test/basic/prettyattributes.coffee:1:completion | completion | suite 'Creating XML with string writer:', ->
test 'Pretty print attributes - 1', ->
eq(
xml('test', { headless: true })
.ele('node', {"first":"1", "second":"2"})
.end({ pretty: true, width: 20 })
"""
<test>
<node first="1"
second="2"/>
</test>
"""
... | fourth="4"/>
</test>
"""
)
test 'Pretty print attributes - 3', ->
eq(
xml('test', { headless: true })
.ele('node', {"first":"1", "second":"2", "third":"33333333333333333333", "fourth": 4})
.end({ pretty: true, width: 1 })
"""
<test>
<node
first=... | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/prettyattributes.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/prettyattributes.coffee | 1 | 50 |
Atraci/Atraci:coffee/_History.class.coffee:1:raw_corpus | raw_corpus | # Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql(
'CREATE TABLE IF NOT EXISTS history ' +
'(artist, title, cover_url_medium, cover_url_large, last_played)'
)
class History
@clear: (success) ->
db.transaction (tx) ->
tx.executeSql 'DROP TABLE history'
succ... | CoffeeScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_History.class.coffee | 1 | 49 | ||
Atraci/Atraci:coffee/_History.class.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql(
'CREATE TABLE IF NOT EXISTS history ' +
'(artist, title, cover_url_medium, cover_url_large, last_played)'
)
class History
@clear: (success) ->
db.transaction (t... | // Init preparation (should be improved later)
var History;
db.transaction(function(tx) {
return tx.executeSql('CREATE TABLE IF NOT EXISTS history ' + '(artist, title, cover_url_medium, cover_url_large, last_played)');
});
History = class History {
static clear(success) {
return db.transaction(function(tx) {
... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_History.class.coffee | 1 | 49 |
Atraci/Atraci:coffee/_History.class.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Init preparation (should be improved later)
var History;
db.transaction(function(tx) {
return tx.executeSql('CREATE TABLE IF NOT EXISTS history ' + '(artist, title, cover_url_medium, cover_url_large, last_played)');
});
History = class History {
static cle... | # Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql(
'CREATE TABLE IF NOT EXISTS history ' +
'(artist, title, cover_url_medium, cover_url_large, last_played)'
)
class History
@clear: (success) ->
db.transaction (tx) ->
tx.executeSql 'DROP TABLE history'
succ... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_History.class.coffee | 1 | 49 |
Atraci/Atraci:coffee/_History.class.coffee:1:completion | completion | # Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql(
'CREATE TABLE IF NOT EXISTS history ' +
'(artist, title, cover_url_medium, cover_url_large, last_played)'
)
class History
@clear: (success) ->
db.transaction (tx) ->
tx.executeSql 'DROP TABLE history'
succ... | tx.executeSql(
'INSERT INTO history ' +
'(artist, title, cover_url_medium, cover_url_large, last_played) ' +
'VALUES (?, ?, ?, ?, ?)',
[artist, title, cover_url_medium, cover_url_large, unix_timestamp]
)
@getTracks: (success) ->
tracks = []
db.transaction (tx) ->
t... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f | 800 | https://github.com/Atraci/Atraci/blob/a4e3a69e284a1ef05051d95c0dc9bbb90c15b74f/coffee/_History.class.coffee | 1 | 49 |
Atraci/Atraci:coffee/_History.class.coffee:1:raw_corpus | raw_corpus | # Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql 'CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)'
class History
@clear: (success) ->
db.transaction (tx) ->
tx.executeSql 'DROP TABLE history'
s... | CoffeeScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | d4b7f952575352efeff69f232ab345bac48fe586 | 800 | https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/_History.class.coffee | 1 | 32 | ||
Atraci/Atraci:coffee/_History.class.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql 'CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)'
class History
@clear: (success) ->
db.transaction (tx) ->
... | // Init preparation (should be improved later)
var History;
db.transaction(function(tx) {
return tx.executeSql('CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)');
});
History = class History {
static clear(success) {
return db.transaction(function(tx) {
... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | d4b7f952575352efeff69f232ab345bac48fe586 | 800 | https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/_History.class.coffee | 1 | 32 |
Atraci/Atraci:coffee/_History.class.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Init preparation (should be improved later)
var History;
db.transaction(function(tx) {
return tx.executeSql('CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)');
});
History = class History {
static clear(su... | # Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql 'CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)'
class History
@clear: (success) ->
db.transaction (tx) ->
tx.executeSql 'DROP TABLE history'
s... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | d4b7f952575352efeff69f232ab345bac48fe586 | 800 | https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/_History.class.coffee | 1 | 32 |
Atraci/Atraci:coffee/_History.class.coffee:1:completion | completion | # Init preparation (should be improved later)
db.transaction (tx) ->
tx.executeSql 'CREATE TABLE IF NOT EXISTS history (artist, title, cover_url_medium, cover_url_large, last_played)'
class History
@clear: (success) ->
db.transaction (tx) ->
tx.executeSql 'DROP TABLE history'
s... | tx.executeSql 'INSERT INTO history (artist, title, cover_url_medium, cover_url_large, last_played) VALUES (?, ?, ?, ?, ?)', [artist, title, cover_url_medium, cover_url_large, unix_timestamp]
@getTracks: (success) ->
tracks = []
db.transaction (tx) ->
tx.executeSql 'SELECT * FROM history... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_History.class.coffee | MIT | d4b7f952575352efeff69f232ab345bac48fe586 | 800 | https://github.com/Atraci/Atraci/blob/d4b7f952575352efeff69f232ab345bac48fe586/coffee/_History.class.coffee | 1 | 32 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:raw_corpus | raw_corpus | throttle = require "lodash.throttle"
random = require "lodash.random"
module.exports =
enable: ->
@throttledShake = throttle @shake.bind(this), 100, trailing: false
onInput: (editor, editorElement, cursor) ->
@throttledShake editorElement
shake: (editorElement) ->
min = @getConfig "minIntensity"
... | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/screen-shake.coffee | 1 | 31 | ||
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
throttle = require "lodash.throttle"
random = require "lodash.random"
module.exports =
enable: ->
@throttledShake = throttle @shake.bind(this), 100, trailing: false
onInput: (editor, editorElement, cursor) ->
@throttledShake editorElement
shake: ... | var random, throttle;
throttle = require("lodash.throttle");
random = require("lodash.random");
module.exports = {
enable: function() {
return this.throttledShake = throttle(this.shake.bind(this), 100, {
trailing: false
});
},
onInput: function(editor, editorElement, cursor) {
return this.thr... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/screen-shake.coffee | 1 | 31 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var random, throttle;
throttle = require("lodash.throttle");
random = require("lodash.random");
module.exports = {
enable: function() {
return this.throttledShake = throttle(this.shake.bind(this), 100, {
trailing: false
});
},
onInput: functi... | throttle = require "lodash.throttle"
random = require "lodash.random"
module.exports =
enable: ->
@throttledShake = throttle @shake.bind(this), 100, trailing: false
onInput: (editor, editorElement, cursor) ->
@throttledShake editorElement
shake: (editorElement) ->
min = @getConfig "minIntensity"
... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/screen-shake.coffee | 1 | 31 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:completion | completion | throttle = require "lodash.throttle"
random = require "lodash.random"
module.exports =
enable: ->
@throttledShake = throttle @shake.bind(this), 100, trailing: false
onInput: (editor, editorElement, cursor) ->
@throttledShake editorElement
shake: (editorElement) ->
min = @getConfig "minIntensity"
... | y = @shakeIntensity min, max
editorElement.style.top = "#{y}px"
editorElement.style.left = "#{x}px"
setTimeout ->
editorElement.style.top = ""
editorElement.style.left = ""
, 75
shakeIntensity: (min, max) ->
direction = if Math.random() > 0.5 then -1 else 1
random(min, max, true... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 5d1989713f4204e3d12cbcc14325622e74b29dc9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/5d1989713f4204e3d12cbcc14325622e74b29dc9/lib/screen-shake.coffee | 1 | 31 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:raw_corpus | raw_corpus | random = require "lodash.random"
module.exports =
shake: (editorElement) ->
min = @getConfig "minIntensity"
max = @getConfig "maxIntensity"
x = @shakeIntensity min, max
y = @shakeIntensity min, max
editorElement.style.top = "#{y}px"
editorElement.style.left = "#{x}px"
setTimeout ->
... | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 12f93c3bd572d8e8698ae376ec03700dafa9ea7b | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/12f93c3bd572d8e8698ae376ec03700dafa9ea7b/lib/screen-shake.coffee | 1 | 24 | ||
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
random = require "lodash.random"
module.exports =
shake: (editorElement) ->
min = @getConfig "minIntensity"
max = @getConfig "maxIntensity"
x = @shakeIntensity min, max
y = @shakeIntensity min, max
editorElement.style.top = "#{y}px"
e... | var random;
random = require("lodash.random");
module.exports = {
shake: function(editorElement) {
var max, min, x, y;
min = this.getConfig("minIntensity");
max = this.getConfig("maxIntensity");
x = this.shakeIntensity(min, max);
y = this.shakeIntensity(min, max);
editorElement.style.top = `... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 12f93c3bd572d8e8698ae376ec03700dafa9ea7b | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/12f93c3bd572d8e8698ae376ec03700dafa9ea7b/lib/screen-shake.coffee | 1 | 24 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var random;
random = require("lodash.random");
module.exports = {
shake: function(editorElement) {
var max, min, x, y;
min = this.getConfig("minIntensity");
max = this.getConfig("maxIntensity");
x = this.shakeIntensity(min, max);
y = this.sh... | random = require "lodash.random"
module.exports =
shake: (editorElement) ->
min = @getConfig "minIntensity"
max = @getConfig "maxIntensity"
x = @shakeIntensity min, max
y = @shakeIntensity min, max
editorElement.style.top = "#{y}px"
editorElement.style.left = "#{x}px"
setTimeout ->
... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 12f93c3bd572d8e8698ae376ec03700dafa9ea7b | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/12f93c3bd572d8e8698ae376ec03700dafa9ea7b/lib/screen-shake.coffee | 1 | 24 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:completion | completion | random = require "lodash.random"
module.exports =
shake: (editorElement) ->
min = @getConfig "minIntensity"
max = @getConfig "maxIntensity"
x = @shakeIntensity min, max
y = @shakeIntensity min, max
editorElement.style.top = "#{y}px"
editorElement.style.left = "#{x}px" | setTimeout ->
editorElement.style.top = ""
editorElement.style.left = ""
, 75
shakeIntensity: (min, max) ->
direction = if Math.random() > 0.5 then -1 else 1
random(min, max, true) * direction
getConfig: (config) ->
atom.config.get "activate-power-mode.screenShake.#{config}" | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 12f93c3bd572d8e8698ae376ec03700dafa9ea7b | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/12f93c3bd572d8e8698ae376ec03700dafa9ea7b/lib/screen-shake.coffee | 1 | 24 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:raw_corpus | raw_corpus | random = require "lodash.random"
module.exports =
shake: (editorElement) ->
min = @getConfig "minIntensity"
max = @getConfig "maxIntensity"
x = @shakeIntensity min, max
y = @shakeIntensity min, max
editorElement.style.transform = "translate(#{x}, #{y})"
requestAnimationFrame ->
edito... | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 9a85f8860708d5a0fec6e9d36a7cb55febbe01ba | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/9a85f8860708d5a0fec6e9d36a7cb55febbe01ba/lib/screen-shake.coffee | 1 | 21 | ||
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
random = require "lodash.random"
module.exports =
shake: (editorElement) ->
min = @getConfig "minIntensity"
max = @getConfig "maxIntensity"
x = @shakeIntensity min, max
y = @shakeIntensity min, max
editorElement.style.transform = "transla... | var random;
random = require("lodash.random");
module.exports = {
shake: function(editorElement) {
var max, min, x, y;
min = this.getConfig("minIntensity");
max = this.getConfig("maxIntensity");
x = this.shakeIntensity(min, max);
y = this.shakeIntensity(min, max);
editorElement.style.transfo... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 9a85f8860708d5a0fec6e9d36a7cb55febbe01ba | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/9a85f8860708d5a0fec6e9d36a7cb55febbe01ba/lib/screen-shake.coffee | 1 | 21 |
JoelBesada/activate-power-mode:lib/screen-shake.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var random;
random = require("lodash.random");
module.exports = {
shake: function(editorElement) {
var max, min, x, y;
min = this.getConfig("minIntensity");
max = this.getConfig("maxIntensity");
x = this.shakeIntensity(min, max);
y = this.sh... | random = require "lodash.random"
module.exports =
shake: (editorElement) ->
min = @getConfig "minIntensity"
max = @getConfig "maxIntensity"
x = @shakeIntensity min, max
y = @shakeIntensity min, max
editorElement.style.transform = "translate(#{x}, #{y})"
requestAnimationFrame ->
edito... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/screen-shake.coffee | MIT | 9a85f8860708d5a0fec6e9d36a7cb55febbe01ba | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/9a85f8860708d5a0fec6e9d36a7cb55febbe01ba/lib/screen-shake.coffee | 1 | 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.