id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jashkenas/coffeescript:test/option_parser.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Option Parser
# -------------
# TODO: refactor option parser tests
# Ensure that the OptionParser handles arguments correctly.
return unless require?
{OptionParser} = require './../lib/coffeescript/optparse'
opt = new OptionParser [
['-r', '--required [DIR... | // Option Parser
// -------------
// TODO: refactor option parser tests
// Ensure that the OptionParser handles arguments correctly.
var OptionParser, opt;
if (typeof require === "undefined" || require === null) {
return;
}
({OptionParser} = require('./../lib/coffeescript/optparse'));
opt = new OptionParser([['-... | CoffeeScript | JavaScript | jashkenas/coffeescript | test/option_parser.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/test/option_parser.coffee | 1 | 43 |
jashkenas/coffeescript:test/option_parser.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Option Parser
// -------------
// TODO: refactor option parser tests
// Ensure that the OptionParser handles arguments correctly.
var OptionParser, opt;
if (typeof require === "undefined" || require === null) {
return;
}
({OptionParser} = require('./../lib... | # Option Parser
# -------------
# TODO: refactor option parser tests
# Ensure that the OptionParser handles arguments correctly.
return unless require?
{OptionParser} = require './../lib/coffeescript/optparse'
opt = new OptionParser [
['-r', '--required [DIR]', 'desc required']
['-o', '--optional', 'desc... | JavaScript | CoffeeScript | jashkenas/coffeescript | test/option_parser.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/test/option_parser.coffee | 1 | 43 |
jashkenas/coffeescript:test/option_parser.coffee:1:completion | completion | # Option Parser
# -------------
# TODO: refactor option parser tests
# Ensure that the OptionParser handles arguments correctly.
return unless require?
{OptionParser} = require './../lib/coffeescript/optparse'
opt = new OptionParser [
['-r', '--required [DIR]', 'desc required']
['-o', '--optional', 'desc... | test "boolean and parameterised options", ->
result = opt.parse ['--optional', '-r', 'folder', 'one', 'two']
ok result.optional
eq 'folder', result.required
arrayEq ['one', 'two'], result.arguments
test "list options", ->
result = opt.parse ['-l', 'one.txt', '-l', 'two.txt', 'three']
arrayEq ['one.txt', 't... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | test/option_parser.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/test/option_parser.coffee | 1 | 43 |
mauricemach/zappa:tests/middleware.coffee:1:raw_corpus | raw_corpus | zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, ->
@app.use @express.static(__dirname + '/public')
@app.use @express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt', (err, r... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 1 | 50 | ||
mauricemach/zappa:tests/middleware.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, ->
@app.use @express.static(__dirname + '/public')
@app.use @express.responseTime()
... | var port, zappa;
zappa = require('../src/zappa');
port = 15500;
this.tests = {
'vanilla express API': function(t) {
var c, zapp;
t.expect('static', 'response time');
t.wait(3000);
zapp = zappa(port++, function() {
this.app.use(this.express.static(__dirname + '/public'));
return this.app... | CoffeeScript | JavaScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 1 | 50 |
mauricemach/zappa:tests/middleware.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var port, zappa;
zappa = require('../src/zappa');
port = 15500;
this.tests = {
'vanilla express API': function(t) {
var c, zapp;
t.expect('static', 'response time');
t.wait(3000);
zapp = zappa(port++, function() {
this.app.use(this.expres... | zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, ->
@app.use @express.static(__dirname + '/public')
@app.use @express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt', (err, r... | JavaScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 1 | 50 |
mauricemach/zappa:tests/middleware.coffee:1:completion | completion | zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, ->
@app.use @express.static(__dirname + '/public')
@app.use @express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt', (err, r... | c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
'use + shortcuts': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, ->
... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 1 | 50 |
mauricemach/zappa:tests/middleware.coffee:2:raw_corpus | raw_corpus | zapp = zappa port++, ->
@use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
precedence: (t) ->
t.expect 'static'
t.wai... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 51 | 72 | ||
mauricemach/zappa:tests/middleware.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zapp = zappa port++, ->
@use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+... | var c, zapp;
zapp = zappa(port++, function() {
return this.use('static', 'responseTime');
});
c = t.client(zapp.app);
c.get('/foo.txt', function(err, res) {
return t.equal('static', res.body, 'bar');
});
c.get('/', function(err, res) {
return t.ok('response time', res.headers['x-response-time'].match(/\d+ms/)... | CoffeeScript | JavaScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 51 | 72 |
mauricemach/zappa:tests/middleware.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, zapp;
zapp = zappa(port++, function() {
return this.use('static', 'responseTime');
});
c = t.client(zapp.app);
c.get('/foo.txt', function(err, res) {
return t.equal('static', res.body, 'bar');
});
c.get('/', function(err, res) {
return t.ok('respon... | zapp = zappa port++, ->
@use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
precedence: (t) ->
t.expect 'static'
t.wai... | JavaScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 51 | 72 |
mauricemach/zappa:tests/middleware.coffee:2:completion | completion | zapp = zappa port++, ->
@use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/ | precedence: (t) ->
t.expect 'static'
t.wait 3000
zapp = zappa port++, ->
@use @app.router, 'static'
@get '/foo.txt': 'intercepted!'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'intercepted!' | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 725e0103755c9a92fe84de06cee82db00e51a1f8 | 943 | https://github.com/mauricemach/zappa/blob/725e0103755c9a92fe84de06cee82db00e51a1f8/tests/middleware.coffee | 51 | 72 |
mauricemach/zappa:tests/middleware.coffee:1:raw_corpus | raw_corpus | zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt'... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 1 | 50 | ||
mauricemach/zappa:tests/middleware.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.respon... | var port, zappa;
zappa = require('../src/zappa');
port = 15500;
this.tests = {
'vanilla express API': function(t) {
var c, zapp;
t.expect('static', 'response time');
t.wait(3000);
zapp = zappa(port++, {__dirname}, function() {
app.use(express.static(__dirname + '/public'));
return app.u... | CoffeeScript | JavaScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 1 | 50 |
mauricemach/zappa:tests/middleware.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var port, zappa;
zappa = require('../src/zappa');
port = 15500;
this.tests = {
'vanilla express API': function(t) {
var c, zapp;
t.expect('static', 'response time');
t.wait(3000);
zapp = zappa(port++, {__dirname}, function() {
app.use(exp... | zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt'... | JavaScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 1 | 50 |
mauricemach/zappa:tests/middleware.coffee:1:completion | completion | zappa = require '../src/zappa'
port = 15500
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt'... | c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
'use + shortcuts': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirna... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 1 | 50 |
mauricemach/zappa:tests/middleware.coffee:2:raw_corpus | raw_corpus | zapp = zappa port++, {__dirname}, ->
use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
precedence: (t) ->
t.expect 'stati... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 51 | 72 | ||
mauricemach/zappa:tests/middleware.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zapp = zappa port++, {__dirname}, ->
use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'... | var c, zapp;
zapp = zappa(port++, {__dirname}, function() {
return use('static', 'responseTime');
});
c = t.client(zapp.app);
c.get('/foo.txt', function(err, res) {
return t.equal('static', res.body, 'bar');
});
c.get('/', function(err, res) {
return t.ok('response time', res.headers['x-response-time'].match(... | CoffeeScript | JavaScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 51 | 72 |
mauricemach/zappa:tests/middleware.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var c, zapp;
zapp = zappa(port++, {__dirname}, function() {
return use('static', 'responseTime');
});
c = t.client(zapp.app);
c.get('/foo.txt', function(err, res) {
return t.equal('static', res.body, 'bar');
});
c.get('/', function(err, res) {
return t.ok... | zapp = zappa port++, {__dirname}, ->
use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
precedence: (t) ->
t.expect 'stati... | JavaScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 51 | 72 |
mauricemach/zappa:tests/middleware.coffee:2:completion | completion | zapp = zappa port++, {__dirname}, ->
use 'static', 'responseTime'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/ | precedence: (t) ->
t.expect 'static'
t.wait 3000
zapp = zappa port++, ->
use app.router, 'static'
get '/foo.txt': 'intercepted!'
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'intercepted!' | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 64c97637156ed6ea85ffeb3336a2c3bc0fad743f | 943 | https://github.com/mauricemach/zappa/blob/64c97637156ed6ea85ffeb3336a2c3bc0fad743f/tests/middleware.coffee | 51 | 72 |
mauricemach/zappa:tests/middleware.coffee:1:raw_corpus | raw_corpus | @tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.b... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 2fbf020ad24d60be07c440fea35a6d871892f7eb | 943 | https://github.com/mauricemach/zappa/blob/2fbf020ad24d60be07c440fea35a6d871892f7eb/tests/middleware.coffee | 4 | 53 | ||
mauricemach/zappa:tests/middleware.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
c = t.client(zapp.app)
c.ge... | this.tests = {
'vanilla express API': function(t) {
var c, zapp;
t.expect('static', 'response time');
t.wait(3000);
zapp = zappa(port++, {__dirname}, function() {
app.use(express.static(__dirname + '/public'));
return app.use(express.responseTime());
});
c = t.client(zapp.app);
... | CoffeeScript | JavaScript | mauricemach/zappa | tests/middleware.coffee | MIT | 2fbf020ad24d60be07c440fea35a6d871892f7eb | 943 | https://github.com/mauricemach/zappa/blob/2fbf020ad24d60be07c440fea35a6d871892f7eb/tests/middleware.coffee | 4 | 53 |
mauricemach/zappa:tests/middleware.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.tests = {
'vanilla express API': function(t) {
var c, zapp;
t.expect('static', 'response time');
t.wait(3000);
zapp = zappa(port++, {__dirname}, function() {
app.use(express.static(__dirname + '/public'));
return app.use(express.r... | @tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.b... | JavaScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 2fbf020ad24d60be07c440fea35a6d871892f7eb | 943 | https://github.com/mauricemach/zappa/blob/2fbf020ad24d60be07c440fea35a6d871892f7eb/tests/middleware.coffee | 4 | 53 |
mauricemach/zappa:tests/middleware.coffee:1:completion | completion | @tests =
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.b... | t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
use: (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp = zappa port++, {__dirname}, ->
use express.static(__dirname + '/public'), express.responseTime()... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 2fbf020ad24d60be07c440fea35a6d871892f7eb | 943 | https://github.com/mauricemach/zappa/blob/2fbf020ad24d60be07c440fea35a6d871892f7eb/tests/middleware.coffee | 4 | 53 |
mauricemach/zappa:tests/middleware.coffee:2:raw_corpus | raw_corpus | c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
'use + shortcuts + zappa added defaults': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp =... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 2fbf020ad24d60be07c440fea35a6d871892f7eb | 943 | https://github.com/mauricemach/zappa/blob/2fbf020ad24d60be07c440fea35a6d871892f7eb/tests/middleware.coffee | 54 | 86 | ||
mauricemach/zappa:tests/middleware.coffee:2:completion | completion | c = t.client(zapp.app)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
'use + shortcuts + zappa added defaults': (t) ->
t.expect 'static', 'response time'
t.wait 3000
zapp =... | t.equal 'static', res.body, 'bar'
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
precedence: (t) ->
t.expect 'static'
t.wait 3000
zapp = zappa port++, ->
use app.router, 'static'
get '/foo.txt': 'intercepted!'
c = t.client(zapp.app... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 2fbf020ad24d60be07c440fea35a6d871892f7eb | 943 | https://github.com/mauricemach/zappa/blob/2fbf020ad24d60be07c440fea35a6d871892f7eb/tests/middleware.coffee | 54 | 86 |
mauricemach/zappa:tests/middleware.coffee:1:raw_corpus | raw_corpus | zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
t.get '/foo.txt', 'bar'
t.response {url: '/'}, {headers: {'X-Response-... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 9a07f55f8c030b026a3d2a6bb1f32cde77b6806a | 943 | https://github.com/mauricemach/zappa/blob/9a07f55f8c030b026a3d2a6bb1f32cde77b6806a/tests/middleware.coffee | 1 | 38 | ||
mauricemach/zappa:tests/middleware.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
t.get '/foo.txt',... | var zappa;
zappa = require('./support/tester')(require('../src/zappa'));
module.exports = {
'Middleware with vanilla express API': function() {
var t;
t = zappa({__dirname}, function() {
app.use(express.static(__dirname + '/public'));
return app.use(express.responseTime());
});
t.get('/f... | CoffeeScript | JavaScript | mauricemach/zappa | tests/middleware.coffee | MIT | 9a07f55f8c030b026a3d2a6bb1f32cde77b6806a | 943 | https://github.com/mauricemach/zappa/blob/9a07f55f8c030b026a3d2a6bb1f32cde77b6806a/tests/middleware.coffee | 1 | 38 |
mauricemach/zappa:tests/middleware.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var zappa;
zappa = require('./support/tester')(require('../src/zappa'));
module.exports = {
'Middleware with vanilla express API': function() {
var t;
t = zappa({__dirname}, function() {
app.use(express.static(__dirname + '/public'));
return... | zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
t.get '/foo.txt', 'bar'
t.response {url: '/'}, {headers: {'X-Response-... | JavaScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 9a07f55f8c030b026a3d2a6bb1f32cde77b6806a | 943 | https://github.com/mauricemach/zappa/blob/9a07f55f8c030b026a3d2a6bb1f32cde77b6806a/tests/middleware.coffee | 1 | 38 |
mauricemach/zappa:tests/middleware.coffee:1:completion | completion | zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
app.use express.responseTime()
t.get '/foo.txt', 'bar'
t.response {url: '/'}, {headers: {'X-Response-... | t = zappa {__dirname}, ->
use static: __dirname + '/public', 'responseTime'
t.get '/foo.txt', 'bar'
t.response {url: '/'}, {headers: {'X-Response-Time': /\d+ms/}}
'Middleware with `use`, shortcuts and zappa added defaults': ->
t = zappa ->
use 'static', 'responseTime'
t.get '/foo.txt', ... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | 9a07f55f8c030b026a3d2a6bb1f32cde77b6806a | 943 | https://github.com/mauricemach/zappa/blob/9a07f55f8c030b026a3d2a6bb1f32cde77b6806a/tests/middleware.coffee | 1 | 38 |
mauricemach/zappa:tests/middleware.coffee:1:raw_corpus | raw_corpus | zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
t.get '/foo.txt', 'bar'
'Middleware with `use`': ->
t = zappa {__dirname}, ->
use express.static(_... | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/middleware.coffee | 1 | 36 | ||
mauricemach/zappa:tests/middleware.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
t.get '/foo.txt', 'bar'
'Middleware with `use`': ->... | var zappa;
zappa = require('./support/tester')(require('../src/zappa'));
module.exports = {
'Middleware with vanilla express API': function() {
var t;
t = zappa({__dirname}, function() {
return app.use(express.static(__dirname + '/public'));
});
return t.get('/foo.txt', 'bar');
},
'Middlew... | CoffeeScript | JavaScript | mauricemach/zappa | tests/middleware.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/middleware.coffee | 1 | 36 |
mauricemach/zappa:tests/middleware.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var zappa;
zappa = require('./support/tester')(require('../src/zappa'));
module.exports = {
'Middleware with vanilla express API': function() {
var t;
t = zappa({__dirname}, function() {
return app.use(express.static(__dirname + '/public'));
}... | zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
t.get '/foo.txt', 'bar'
'Middleware with `use`': ->
t = zappa {__dirname}, ->
use express.static(_... | JavaScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/middleware.coffee | 1 | 36 |
mauricemach/zappa:tests/middleware.coffee:1:completion | completion | zappa = require('./support/tester') require('../src/zappa')
module.exports =
'Middleware with vanilla express API': ->
t = zappa {__dirname}, ->
app.use express.static(__dirname + '/public')
t.get '/foo.txt', 'bar'
'Middleware with `use`': ->
t = zappa {__dirname}, ->
use express.static(_... | use static: __dirname + '/public', 'responseTime'
t.get '/foo.txt', 'bar'
t.response {url: '/'}, {headers: {'X-Response-Time': /\d+ms/}}
'Middleware with `use`, shortcuts and zappa added defaults': ->
t = zappa ->
use 'static', 'responseTime'
t.get '/foo.txt', 'bar'
t.response {url: '/'},... | CoffeeScript | CoffeeScript | mauricemach/zappa | tests/middleware.coffee | MIT | e338cf805cb6b68ea06957166238560063d1f1e4 | 943 | https://github.com/mauricemach/zappa/blob/e338cf805cb6b68ea06957166238560063d1f1e4/tests/middleware.coffee | 1 | 36 |
jianliaoim/talk-os:talk-api2x/server/controllers/preference.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
limbo = require 'limbo'
{PreferenceModel} = limbo.use 'talk'
app = require '../server'
module.exports = preferenceController = app.controller 'preference', ->
@action 'readOne', (req, res, callback) ->
{_sessionUserId} = req.get()
PreferenceModel.findOne _id: _sessionUserId, (err, pref... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/preference.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/preference.coffee | 1 | 40 | ||
jianliaoim/talk-os:talk-api2x/server/controllers/preference.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
limbo = require 'limbo'
{PreferenceModel} = limbo.use 'talk'
app = require '../server'
module.exports = preferenceController = app.controller 'preference', ->
@action 'readOne', (req, res, callback) ->
{_sessionUserId} = req.get()
... | var PreferenceModel, _, app, limbo, preferenceController;
_ = require('lodash');
limbo = require('limbo');
({PreferenceModel} = limbo.use('talk'));
app = require('../server');
module.exports = preferenceController = app.controller('preference', function() {
this.action('readOne', function(req, res, callback) {
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/controllers/preference.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/preference.coffee | 1 | 40 |
jianliaoim/talk-os:talk-api2x/server/controllers/preference.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var PreferenceModel, _, app, limbo, preferenceController;
_ = require('lodash');
limbo = require('limbo');
({PreferenceModel} = limbo.use('talk'));
app = require('../server');
module.exports = preferenceController = app.controller('preference', function() {
... | _ = require 'lodash'
limbo = require 'limbo'
{PreferenceModel} = limbo.use 'talk'
app = require '../server'
module.exports = preferenceController = app.controller 'preference', ->
@action 'readOne', (req, res, callback) ->
{_sessionUserId} = req.get()
PreferenceModel.findOne _id: _sessionUserId, (err, pref... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/preference.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/preference.coffee | 1 | 40 |
jianliaoim/talk-os:talk-api2x/server/controllers/preference.coffee:1:completion | completion | _ = require 'lodash'
limbo = require 'limbo'
{PreferenceModel} = limbo.use 'talk'
app = require '../server'
module.exports = preferenceController = app.controller 'preference', ->
@action 'readOne', (req, res, callback) ->
{_sessionUserId} = req.get()
PreferenceModel.findOne _id: _sessionUserId, (err, pref... | 'hasShownTips'
'hasShownRichTextTips'
'language'
'notifyOnRelated'
'displayMode'
'_latestTeamId'
'_latestRoomId'
'customOptions'
'muteWhenWebOnline'
'webData'
'timezone'
'pushOnWorkTime'
]
if req.get('pushOnWorkTime')
return callback(new Er... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/preference.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/preference.coffee | 1 | 40 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | class root.Lethargy
constructor: (stability, sensitivity, tolerance, delay) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If an event has a wheelDelta below this value, it will not register
@se... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | e562bdcebb902e59e6ccf70be2eeb83c62a409c7 | 572 | https://github.com/d4nyll/lethargy/blob/e562bdcebb902e59e6ccf70be2eeb83c62a409c7/lethargy.coffee | 3 | 52 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class root.Lethargy
constructor: (stability, sensitivity, tolerance, delay) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If an event has a ... | root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance, delay) {
// Stability is how many records to use to calculate the average
this.stability = stability != null ? Math.abs(stability) : 8;
// The wheelDelta threshold. If an event has a wheelDelta below this value, it will not re... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | e562bdcebb902e59e6ccf70be2eeb83c62a409c7 | 572 | https://github.com/d4nyll/lethargy/blob/e562bdcebb902e59e6ccf70be2eeb83c62a409c7/lethargy.coffee | 3 | 52 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance, delay) {
// Stability is how many records to use to calculate the average
this.stability = stability != null ? Math.abs(stability) : 8;
// The wheelDelta threshold. If an ... | class root.Lethargy
constructor: (stability, sensitivity, tolerance, delay) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If an event has a wheelDelta below this value, it will not register
@se... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | e562bdcebb902e59e6ccf70be2eeb83c62a409c7 | 572 | https://github.com/d4nyll/lethargy/blob/e562bdcebb902e59e6ccf70be2eeb83c62a409c7/lethargy.coffee | 3 | 52 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | class root.Lethargy
constructor: (stability, sensitivity, tolerance, delay) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If an event has a wheelDelta below this value, it will not register
@se... | # Standardise wheelDelta values for different browsers
if e.wheelDelta?
lastDelta = e.wheelDelta
else if e.deltaY?
lastDelta = e.deltaY * -40
else if (e.detail? or e.detail == 0)
lastDelta = e.detail * -40
# Add the new event timestamp to deltasTimestamp array, and remove the oldest e... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | e562bdcebb902e59e6ccf70be2eeb83c62a409c7 | 572 | https://github.com/d4nyll/lethargy/blob/e562bdcebb902e59e6ccf70be2eeb83c62a409c7/lethargy.coffee | 3 | 52 |
d4nyll/lethargy:lethargy.coffee:2:raw_corpus | raw_corpus | # Get the relevant last*Delta array
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
# If the array is not filled up yet, we cannot compare averages, so assume the scroll event to be intentional
if lastDeltas[0] == null
return direction
# If the last mousewheel occurred wi... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | e562bdcebb902e59e6ccf70be2eeb83c62a409c7 | 572 | https://github.com/d4nyll/lethargy/blob/e562bdcebb902e59e6ccf70be2eeb83c62a409c7/lethargy.coffee | 53 | 83 | ||
d4nyll/lethargy:lethargy.coffee:2:completion | completion | # Get the relevant last*Delta array
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
# If the array is not filled up yet, we cannot compare averages, so assume the scroll event to be intentional
if lastDeltas[0] == null
return direction
# If the last mousewheel occurred wi... | oldSum = lastDeltasOld.reduce (t, s) -> t + s
newSum = lastDeltasNew.reduce (t, s) -> t + s
oldAverage = oldSum / lastDeltasOld.length
newAverage = newSum / lastDeltasNew.length
if Math.abs(oldAverage) < Math.abs(newAverage * @tolerance) && (@sensitivity < Math.abs(newAverage))
direction
els... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | e562bdcebb902e59e6ccf70be2eeb83c62a409c7 | 572 | https://github.com/d4nyll/lethargy/blob/e562bdcebb902e59e6ccf70be2eeb83c62a409c7/lethargy.coffee | 53 | 83 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If an event has a wheelDelta below this value, it will not ... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 733f83701ad7cadc8347e72c34151b87196fd319 | 572 | https://github.com/d4nyll/lethargy/blob/733f83701ad7cadc8347e72c34151b87196fd319/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
// Stability is how many records to use to calculate the average
this.stability = stability != null ? Math.abs(stability) : 8;
// The wh... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 733f83701ad7cadc8347e72c34151b87196fd319 | 572 | https://github.com/d4nyll/lethargy/blob/733f83701ad7cadc8347e72c34151b87196fd319/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
// Stability is how many records to use to calculate the average
this.stability = sta... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If an event has a wheelDelta below this value, it will not ... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 733f83701ad7cadc8347e72c34151b87196fd319 | 572 | https://github.com/d4nyll/lethargy/blob/733f83701ad7cadc8347e72c34151b87196fd319/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
# Stability is how many records to use to calculate the average
@stability = if stability? then Math.abs stability else 8
# The wheelDelta threshold. If an event has a wheelDelta below this value, it will not ... | if e.wheelDelta?
lastDelta = e.wheelDelta
else if e.deltaY?
lastDelta = e.deltaY * -40
else if (e.detail? or e.detail == 0)
lastDelta = e.detail * -40
# Add the new event timestamp to deltasTimestamp array, and remove the oldest entry
@deltasTimestamp.push(Date.now())
@deltasTimes... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 733f83701ad7cadc8347e72c34151b87196fd319 | 572 | https://github.com/d4nyll/lethargy/blob/733f83701ad7cadc8347e72c34151b87196fd319/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:2:raw_corpus | raw_corpus | lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
# If the array is not filled up yet, we cannot compare averages, so assume the scroll event to be intentional
if lastDeltas[0] == null
return direction
# If the last mousewheel occurred within 150 miliseconds of the penultimate ... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 733f83701ad7cadc8347e72c34151b87196fd319 | 572 | https://github.com/d4nyll/lethargy/blob/733f83701ad7cadc8347e72c34151b87196fd319/lethargy.coffee | 51 | 80 | ||
d4nyll/lethargy:lethargy.coffee:2:completion | completion | lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
# If the array is not filled up yet, we cannot compare averages, so assume the scroll event to be intentional
if lastDeltas[0] == null
return direction
# If the last mousewheel occurred within 150 miliseconds of the penultimate ... | newSum = lastDeltasNew.reduce (t, s) -> t + s
oldAverage = oldSum / lastDeltasOld.length
newAverage = newSum / lastDeltasNew.length
if Math.abs(oldAverage) < Math.abs(newAverage * @tolerance) && (@sensitivity < Math.abs(newAverage))
direction
else
false
showLastUpDeltas: ->
return @... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 733f83701ad7cadc8347e72c34151b87196fd319 | 572 | https://github.com/d4nyll/lethargy/blob/733f83701ad7cadc8347e72c34151b87196fd319/lethargy.coffee | 51 | 80 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 009cb97d35a255841fdba8d44139451dbe18122c | 572 | https://github.com/d4nyll/lethargy/blob/009cb97d35a255841fdba8d44139451dbe18122c/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance?... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100;
... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 009cb97d35a255841fdba8d44139451dbe18122c | 572 | https://github.com/d4nyll/lethargy/blob/009cb97d35a255841fdba8d44139451dbe18122c/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sens... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 009cb97d35a255841fdba8d44139451dbe18122c | 572 | https://github.com/d4nyll/lethargy/blob/009cb97d35a255841fdba8d44139451dbe18122c/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | @lastUpDeltas.shift()
return @isInertia(1)
else
@lastDownDeltas.push(lastDelta)
@lastDownDeltas.shift()
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if lastDeltas[0] == null
return directio... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 009cb97d35a255841fdba8d44139451dbe18122c | 572 | https://github.com/d4nyll/lethargy/blob/009cb97d35a255841fdba8d44139451dbe18122c/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:2:raw_corpus | raw_corpus | else
false
showLastUpDeltas: ->
return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 009cb97d35a255841fdba8d44139451dbe18122c | 572 | https://github.com/d4nyll/lethargy/blob/009cb97d35a255841fdba8d44139451dbe18122c/lethargy.coffee | 51 | 58 | ||
d4nyll/lethargy:lethargy.coffee:2:completion | completion | else
false
showLastUpDeltas: -> | return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 009cb97d35a255841fdba8d44139451dbe18122c | 572 | https://github.com/d4nyll/lethargy/blob/009cb97d35a255841fdba8d44139451dbe18122c/lethargy.coffee | 51 | 58 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf | 572 | https://github.com/d4nyll/lethargy/blob/6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | @lastUpDeltas.push(lastDelta)
@lastUpDeltas.shift()
return @isInertia(1)
else
@lastDownDeltas.push(lastDelta)
@lastDownDeltas.shift()
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if lastDel... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf | 572 | https://github.com/d4nyll/lethargy/blob/6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:2:raw_corpus | raw_corpus | direction
else
false
showLastUpDeltas: ->
return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf | 572 | https://github.com/d4nyll/lethargy/blob/6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf/lethargy.coffee | 51 | 59 | ||
d4nyll/lethargy:lethargy.coffee:2:completion | completion | direction
else
false | showLastUpDeltas: ->
return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf | 572 | https://github.com/d4nyll/lethargy/blob/6bd9f0d4c6f9720cbbb47c05e0134079cd5e3ebf/lethargy.coffee | 51 | 59 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95 | 572 | https://github.com/d4nyll/lethargy/blob/c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance?... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100;
... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95 | 572 | https://github.com/d4nyll/lethargy/blob/c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sens... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95 | 572 | https://github.com/d4nyll/lethargy/blob/c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | @lastUpDeltas.shift()
return @isInertia(1)
else
@lastDownDeltas.push(lastDelta)
@lastDownDeltas.shift()
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if lastDeltas[0] == null
return directio... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95 | 572 | https://github.com/d4nyll/lethargy/blob/c3957d6c3a51c40c8b2f86711ee3e7f1c444ca95/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 1142a1c8eeb73138189f41161dc44852194e1c2d | 572 | https://github.com/d4nyll/lethargy/blob/1142a1c8eeb73138189f41161dc44852194e1c2d/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance?... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100;
... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 1142a1c8eeb73138189f41161dc44852194e1c2d | 572 | https://github.com/d4nyll/lethargy/blob/1142a1c8eeb73138189f41161dc44852194e1c2d/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sens... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 1142a1c8eeb73138189f41161dc44852194e1c2d | 572 | https://github.com/d4nyll/lethargy/blob/1142a1c8eeb73138189f41161dc44852194e1c2d/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | @lastUpDeltas.shift()
return @isInertia(1)
else
@lastDownDeltas.push(lastDelta)
@lastDownDeltas.shift()
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if lastDeltas[0] == null
return directio... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 1142a1c8eeb73138189f41161dc44852194e1c2d | 572 | https://github.com/d4nyll/lethargy/blob/1142a1c8eeb73138189f41161dc44852194e1c2d/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance?... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100;
... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sens... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | if (lastDelta > 0)
@lastUpDeltas.push(lastDelta)
@lastUpDeltas.shift()
return @isInertia(1)
else
@lastDownDeltas.push(lastDelta)
@lastDownDeltas.shift()
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @la... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:2:raw_corpus | raw_corpus | if Math.abs(oldAverage) < Math.abs(newAverage * @tolerance) && (@sensitivity < Math.abs(newAverage))
direction
else
false
showLastUpDeltas: ->
return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 51 | 61 | ||
d4nyll/lethargy:lethargy.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if Math.abs(oldAverage) < Math.abs(newAverage * @tolerance) && (@sensitivity < Math.abs(newAverage))
direction
else
false
showLastUpDeltas: ->
return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas
``` | if (Math.abs(oldAverage) < Math.abs(newAverage * this.tolerance) && (this.sensitivity < Math.abs(newAverage))) {
direction;
} else {
false;
}
({
showLastUpDeltas: function() {
return this.lastUpDeltas;
},
showLastDownDeltas: function() {
return this.lastDownDeltas;
}
}); | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 51 | 61 |
d4nyll/lethargy:lethargy.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (Math.abs(oldAverage) < Math.abs(newAverage * this.tolerance) && (this.sensitivity < Math.abs(newAverage))) {
direction;
} else {
false;
}
({
showLastUpDeltas: function() {
return this.lastUpDeltas;
},
showLastDownDeltas: function() {
return t... | if Math.abs(oldAverage) < Math.abs(newAverage * @tolerance) && (@sensitivity < Math.abs(newAverage))
direction
else
false
showLastUpDeltas: ->
return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 51 | 61 |
d4nyll/lethargy:lethargy.coffee:2:completion | completion | if Math.abs(oldAverage) < Math.abs(newAverage * @tolerance) && (@sensitivity < Math.abs(newAverage))
direction
else
false | showLastUpDeltas: ->
return @lastUpDeltas
showLastDownDeltas: ->
return @lastDownDeltas | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 3a7f6bdb28b0a4cda6130e584604ca7a98d15f52 | 572 | https://github.com/d4nyll/lethargy/blob/3a7f6bdb28b0a4cda6130e584604ca7a98d15f52/lethargy.coffee | 51 | 61 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | d3d41bd00752c9e91b39d8561bb77b4ab611e4fc | 572 | https://github.com/d4nyll/lethargy/blob/d3d41bd00752c9e91b39d8561bb77b4ab611e4fc/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance?... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100;
... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | d3d41bd00752c9e91b39d8561bb77b4ab611e4fc | 572 | https://github.com/d4nyll/lethargy/blob/d3d41bd00752c9e91b39d8561bb77b4ab611e4fc/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sens... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | d3d41bd00752c9e91b39d8561bb77b4ab611e4fc | 572 | https://github.com/d4nyll/lethargy/blob/d3d41bd00752c9e91b39d8561bb77b4ab611e4fc/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | @lastUpDeltas.shift()
return @isInertia(1)
else
@lastDownDeltas.push(lastDelta)
@lastDownDeltas.shift()
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if lastDeltas[0] == null
return directio... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | d3d41bd00752c9e91b39d8561bb77b4ab611e4fc | 572 | https://github.com/d4nyll/lethargy/blob/d3d41bd00752c9e91b39d8561bb77b4ab611e4fc/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 57d37bff10cf3e630980619e1fc5f07bed6cc40b | 572 | https://github.com/d4nyll/lethargy/blob/57d37bff10cf3e630980619e1fc5f07bed6cc40b/lethargy.coffee | 1 | 49 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance?... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100;
... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 57d37bff10cf3e630980619e1fc5f07bed6cc40b | 572 | https://github.com/d4nyll/lethargy/blob/57d37bff10cf3e630980619e1fc5f07bed6cc40b/lethargy.coffee | 1 | 49 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sens... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 57d37bff10cf3e630980619e1fc5f07bed6cc40b | 572 | https://github.com/d4nyll/lethargy/blob/57d37bff10cf3e630980619e1fc5f07bed6cc40b/lethargy.coffee | 1 | 49 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if lastDeltas[0] == null
return direction
lastDeltasOld = lastDeltas.slice(0, @stability)
lastDeltasNew = lastDeltas.slice(@stability, (@stability * 2))
oldSum = lastDeltasOld.reduce (t... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 57d37bff10cf3e630980619e1fc5f07bed6cc40b | 572 | https://github.com/d4nyll/lethargy/blob/57d37bff10cf3e630980619e1fc5f07bed6cc40b/lethargy.coffee | 1 | 49 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 61228012557c9870a116b3ff08a094aaac8122a0 | 572 | https://github.com/d4nyll/lethargy/blob/61228012557c9870a116b3ff08a094aaac8122a0/lethargy.coffee | 1 | 45 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance?... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100;
... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 61228012557c9870a116b3ff08a094aaac8122a0 | 572 | https://github.com/d4nyll/lethargy/blob/61228012557c9870a116b3ff08a094aaac8122a0/lethargy.coffee | 1 | 45 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(stability, sensitivity, tolerance) {
this.stability = stability != null ? Math.abs(stability) : 8;
this.sensitivity = sens... | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 61228012557c9870a116b3ff08a094aaac8122a0 | 572 | https://github.com/d4nyll/lethargy/blob/61228012557c9870a116b3ff08a094aaac8122a0/lethargy.coffee | 1 | 45 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (stability, sensitivity, tolerance) ->
@stability = if stability? then Math.abs stability else 8
@sensitivity = if sensitivity? then 1 + Math.abs sensitivity else 100
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas =... | isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if lastDeltas[0] == null
return direction
lastDeltasOld = lastDeltas.slice(0, @stability)
lastDeltasNew = lastDeltas.slice(@stability, (@stability * 2))
oldSum = lastDeltasOld.reduce (t, s) -> t ... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 61228012557c9870a116b3ff08a094aaac8122a0 | 572 | https://github.com/d4nyll/lethargy/blob/61228012557c9870a116b3ff08a094aaac8122a0/lethargy.coffee | 1 | 45 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (null for [1..(@range * 2)])
@lastDownDeltas = (null for [1..(@range * 2)]... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 42a330a13c48eefed302f12d8e88360dfecc3e35 | 572 | https://github.com/d4nyll/lethargy/blob/42a330a13c48eefed302f12d8e88360dfecc3e35/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (null for [1..(@range... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(range, tolerance) {
// console.log range
this.range = range != null ? Math.abs(range) : 5;
this.tolerance = tolerance != null ? 1 + Math.abs(tolerance) : 1.1;
this.lastU... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 42a330a13c48eefed302f12d8e88360dfecc3e35 | 572 | https://github.com/d4nyll/lethargy/blob/42a330a13c48eefed302f12d8e88360dfecc3e35/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(range, tolerance) {
// console.log range
this.range = range != null ? Math.abs(range) : 5;
this.tolerance = tolerance ... | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (null for [1..(@range * 2)])
@lastDownDeltas = (null for [1..(@range * 2)]... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 42a330a13c48eefed302f12d8e88360dfecc3e35 | 572 | https://github.com/d4nyll/lethargy/blob/42a330a13c48eefed302f12d8e88360dfecc3e35/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (null for [1..(@range * 2)])
@lastDownDeltas = (null for [1..(@range * 2)]... | isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
if Math.abs(lastDeltas[lastDeltas.length - 1]) == 120 || lastDeltas[0] == null
return false
lastDeltasOld = lastDeltas.slice(0, @range)
lastDeltasNew = lastDeltas.slice(@range, (@range * 2))
oldS... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 42a330a13c48eefed302f12d8e88360dfecc3e35 | 572 | https://github.com/d4nyll/lethargy/blob/42a330a13c48eefed302f12d8e88360dfecc3e35/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * 2)])
@lastDownDeltas = (0 for [1..(@range * 2)])
c... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46 | 572 | https://github.com/d4nyll/lethargy/blob/b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * ... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(range, tolerance) {
// console.log range
this.range = range != null ? Math.abs(range) : 5;
this.tolerance = tolerance != null ? 1 + Math.abs(tolerance) : 1.1;
this.lastU... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46 | 572 | https://github.com/d4nyll/lethargy/blob/b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(range, tolerance) {
// console.log range
this.range = range != null ? Math.abs(range) : 5;
this.tolerance = tolerance ... | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * 2)])
@lastDownDeltas = (0 for [1..(@range * 2)])
c... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46 | 572 | https://github.com/d4nyll/lethargy/blob/b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * 2)])
@lastDownDeltas = (0 for [1..(@range * 2)])
c... | # console.log "inertia: " + temp
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
lastDeltasOld = lastDeltas.slice(0, @range)
lastDeltasNew = lastDeltas.slice(@range, (@range * 2))
oldSum = lastDeltasOld.reduce (... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46 | 572 | https://github.com/d4nyll/lethargy/blob/b4bcb6acadf97f4640d8f8ce75146dcd8e57cb46/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:raw_corpus | raw_corpus | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * 2)])
@lastDownDeltas = (0 for [1..(@range * 2)])
c... | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7 | 572 | https://github.com/d4nyll/lethargy/blob/1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7/lethargy.coffee | 1 | 50 | ||
d4nyll/lethargy:lethargy.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * ... | var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(range, tolerance) {
// console.log range
this.range = range != null ? Math.abs(range) : 5;
this.tolerance = tolerance != null ? 1 + Math.abs(tolerance) : 1.1;
this.lastU... | CoffeeScript | JavaScript | d4nyll/lethargy | lethargy.coffee | MIT | 1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7 | 572 | https://github.com/d4nyll/lethargy/blob/1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var root;
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.Lethargy = class Lethargy {
constructor(range, tolerance) {
// console.log range
this.range = range != null ? Math.abs(range) : 5;
this.tolerance = tolerance ... | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * 2)])
@lastDownDeltas = (0 for [1..(@range * 2)])
c... | JavaScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7 | 572 | https://github.com/d4nyll/lethargy/blob/1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7/lethargy.coffee | 1 | 50 |
d4nyll/lethargy:lethargy.coffee:1:completion | completion | root = exports ? this
class root.Lethargy
constructor: (range, tolerance) ->
# console.log range
@range = if range? then Math.abs range else 5
@tolerance = if tolerance? then 1 + Math.abs tolerance else 1.1
@lastUpDeltas = (0 for [1..(@range * 2)])
@lastDownDeltas = (0 for [1..(@range * 2)])
c... | console.log "inertia: " + temp
return @isInertia(-1)
false;
isInertia: (direction) ->
lastDeltas = if direction == -1 then @lastDownDeltas else @lastUpDeltas
lastDeltasOld = lastDeltas.slice(0, @range)
lastDeltasNew = lastDeltas.slice(@range, (@range * 2))
oldSum = lastDeltasOld.reduce (t,... | CoffeeScript | CoffeeScript | d4nyll/lethargy | lethargy.coffee | MIT | 1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7 | 572 | https://github.com/d4nyll/lethargy/blob/1c51ef9053fe7d4a9e55ee6a64af53a96d49f9c7/lethargy.coffee | 1 | 50 |
discolabs/cartjs:src/core.coffee:1:raw_corpus | raw_corpus | # CartJS.Core
# Core API methods for manipulating carts.
# ----------------------------------------
CartJS.Core =
# Fetch updated cart object from API endpoint.
getCart: (options = {}) ->
options.type = 'GET'
options.updateCart = true
CartJS.Queue.add '/cart.js', {v: new Date().getTime()}, options
... | CoffeeScript | discolabs/cartjs | src/core.coffee | MIT | 3d60425769d593c5e0968fd22d12ff78c63bcc4f | 493 | https://github.com/discolabs/cartjs/blob/3d60425769d593c5e0968fd22d12ff78c63bcc4f/src/core.coffee | 1 | 39 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.