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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:completion | completion | it 'should create a new subscription for uuid1', (done) ->
@database.subscriptions.findOne {}, (error, subscription) =>
return done error if error?
subscription = _.omit subscription, '_id'
expect(subscription).to.deep.equal subscriberUuid: @open_device.uuid, emitterUuid: @closed_d... | it 'should not create a new subscription in the database', ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 1
done()
describe 'when someone else creates a subscription from the closed devi... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 41 | 79 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:3:raw_corpus | raw_corpus | it 'should create exactly no subscriptions in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 0
done()
it 'should yield an error', ->
expect(@error).to.be.an.insta... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 81 | 89 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should create exactly no subscriptions in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 0
done()
it 'should ... | it('should create exactly no subscriptions in the database', function(done) {
return this.database.subscriptions.count({}, (error, subscriptionCount) => {
if (error != null) {
return done(error);
}
expect(subscriptionCount).to.equal(0);
return done();
});
});
it('should yield an error', funct... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 81 | 89 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should create exactly no subscriptions in the database', function(done) {
return this.database.subscriptions.count({}, (error, subscriptionCount) => {
if (error != null) {
return done(error);
}
expect(subscriptionCount).to.equal(0);
retu... | it 'should create exactly no subscriptions in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 0
done()
it 'should yield an error', ->
expect(@error).to.be.an.insta... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 81 | 89 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:3:completion | completion | it 'should create exactly no subscriptions in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 0 | done()
it 'should yield an error', ->
expect(@error).to.be.an.instanceOf Error
expect(@error.message).to.deep.equal 'Insufficient permissions to subscribe on behalf of that device' | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | a9aac28463fe42fc81311742a93dd245ad47d0a7 | 815 | https://github.com/octoblu/meshblu/blob/a9aac28463fe42fc81311742a93dd245ad47d0a7/test/lib/createSubscriptionIfAuthorized-spec.coffee | 81 | 89 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | c7bf021cddec4c041efa7c0360dac2ffca80acfb | 815 | https://github.com/octoblu/meshblu/blob/c7bf021cddec4c041efa7c0360dac2ffca80acfb/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 50 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@d... | var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEach(function(done) {
return TestDatabase.open((error,... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | c7bf021cddec4c041efa7c0360dac2ffca80acfb | 815 | https://github.com/octoblu/meshblu/blob/c7bf021cddec4c041efa7c0360dac2ffca80acfb/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 50 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestDatabase, _;
_ = require('lodash');
TestDatabase = require('../test-database');
describe('createSubscriptionIfAuthorized', function() {
beforeEach(function() {
return this.sut = require('../../lib/createSubscriptionIfAuthorized');
});
beforeEac... | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | c7bf021cddec4c041efa7c0360dac2ffca80acfb | 815 | https://github.com/octoblu/meshblu/blob/c7bf021cddec4c041efa7c0360dac2ffca80acfb/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 50 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:1:completion | completion | _ = require 'lodash'
TestDatabase = require '../test-database'
describe 'createSubscriptionIfAuthorized', ->
beforeEach ->
@sut = require '../../lib/createSubscriptionIfAuthorized'
beforeEach (done) ->
TestDatabase.open (error, database) =>
@database = database
@dependencies = database: @datab... | uuid: @open_device.uuid
targetUuid: @closed_device.uuid
type: 'event'
}
@dependencies.getDevice = sinon.stub().yields null, @open_device
@sut @open_device, params, done, @dependencies
it 'should create exactly one subscription in the database', (done) ->
@dat... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | c7bf021cddec4c041efa7c0360dac2ffca80acfb | 815 | https://github.com/octoblu/meshblu/blob/c7bf021cddec4c041efa7c0360dac2ffca80acfb/test/lib/createSubscriptionIfAuthorized-spec.coffee | 1 | 50 |
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:raw_corpus | raw_corpus | params = {
uuid: @closed_device.uuid
targetUuid: @open_device.uuid
type: 'event'
}
@dependencies.getDevice = sinon.stub().yields null, @closed_device
storeError = (@error) => done()
@sut @other_device, params, storeError, @dependencies
it 'should cr... | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | c7bf021cddec4c041efa7c0360dac2ffca80acfb | 815 | https://github.com/octoblu/meshblu/blob/c7bf021cddec4c041efa7c0360dac2ffca80acfb/test/lib/createSubscriptionIfAuthorized-spec.coffee | 51 | 71 | ||
octoblu/meshblu:test/lib/createSubscriptionIfAuthorized-spec.coffee:2:completion | completion | params = {
uuid: @closed_device.uuid
targetUuid: @open_device.uuid
type: 'event'
}
@dependencies.getDevice = sinon.stub().yields null, @closed_device
storeError = (@error) => done()
@sut @other_device, params, storeError, @dependencies | it 'should create exactly no subscriptions in the database', (done) ->
@database.subscriptions.count {}, (error, subscriptionCount) =>
return done error if error?
expect(subscriptionCount).to.equal 0
done()
it 'should yield an error', ->
expect(@error).to.be.an.insta... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/createSubscriptionIfAuthorized-spec.coffee | MIT | c7bf021cddec4c041efa7c0360dac2ffca80acfb | 815 | https://github.com/octoblu/meshblu/blob/c7bf021cddec4c041efa7c0360dac2ffca80acfb/test/lib/createSubscriptionIfAuthorized-spec.coffee | 51 | 71 |
mauricemach/coffeekup:src/cli.coffee:2:raw_corpus | raw_corpus | compile = (input_path, output_directory, js, namespace = 'templates') ->
fs.readFile input_path, 'utf-8', (err, contents) ->
handle_error err
name = path.basename input_path, path.extname(input_path)
if not js
output = coffeekup.render contents, options
ext = '.html'
else
func = co... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 12 | 31 | ||
mauricemach/coffeekup:src/cli.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
compile = (input_path, output_directory, js, namespace = 'templates') ->
fs.readFile input_path, 'utf-8', (err, contents) ->
handle_error err
name = path.basename input_path, path.extname(input_path)
if not js
output = coffeekup.render conte... | var compile;
compile = function(input_path, output_directory, js, namespace = 'templates') {
return fs.readFile(input_path, 'utf-8', function(err, contents) {
var ext, func, name, output;
handle_error(err);
name = path.basename(input_path, path.extname(input_path));
if (!js) {
output = coffeeku... | CoffeeScript | JavaScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 12 | 31 |
mauricemach/coffeekup:src/cli.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var compile;
compile = function(input_path, output_directory, js, namespace = 'templates') {
return fs.readFile(input_path, 'utf-8', function(err, contents) {
var ext, func, name, output;
handle_error(err);
name = path.basename(input_path, path.extna... | compile = (input_path, output_directory, js, namespace = 'templates') ->
fs.readFile input_path, 'utf-8', (err, contents) ->
handle_error err
name = path.basename input_path, path.extname(input_path)
if not js
output = coffeekup.render contents, options
ext = '.html'
else
func = co... | JavaScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 12 | 31 |
mauricemach/coffeekup:src/cli.coffee:2:completion | completion | compile = (input_path, output_directory, js, namespace = 'templates') ->
fs.readFile input_path, 'utf-8', (err, contents) ->
handle_error err
name = path.basename input_path, path.extname(input_path)
if not js
output = coffeekup.render contents, options
ext = '.html'
else | func = coffeekup.compile contents, options
output = """
(function(){
this.#{namespace} || (this.#{namespace} = {});
this.#{namespace}[#{JSON.stringify name}] = #{func};
}).call(this);
"""
ext = '.js'
write input_path, name, output, output_directory, ext | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 12 | 31 |
mauricemach/coffeekup:src/cli.coffee:3:raw_corpus | raw_corpus | write = (input_path, name, contents, output_directory, ext) ->
filename = name + ext
dir = output_directory or path.dirname input_path
path.exists dir, (exists) ->
unless exists then fs.mkdirSync dir, 0777
output_path = path.join dir, filename
contents = ' ' if contents.length <= 0
fs.writeFile o... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 33 | 61 | ||
mauricemach/coffeekup:src/cli.coffee:3:completion | completion | write = (input_path, name, contents, output_directory, ext) ->
filename = name + ext
dir = output_directory or path.dirname input_path
path.exists dir, (exists) ->
unless exists then fs.mkdirSync dir, 0777
output_path = path.join dir, filename
contents = ' ' if contents.length <= 0
fs.writeFile o... | Usage:
coffeekup [options] path/to/template.coffee
'''
switches = [
['--js', 'compile template to js function']
['-n', '--namespace [name]', 'global object holding the templates (default: "templates")']
['-w', '--watch', 'watch templates for changes, and recompile']
['-o', '--output [dir]', 'set the direct... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 33 | 61 |
mauricemach/coffeekup:src/cli.coffee:4:raw_corpus | raw_corpus | @run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) -... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 63 | 85 | ||
mauricemach/coffeekup:src/cli.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
... | this.run = function() {
var args, file, options, parser;
parser = new OptionParser(switches, usage);
options = parser.parse(argv);
args = options.arguments;
delete options.arguments;
if (options.help || argv.length === 0) {
puts(parser.help());
}
if (options.version) {
puts(coffeekup.version);
... | CoffeeScript | JavaScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 63 | 85 |
mauricemach/coffeekup:src/cli.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.run = function() {
var args, file, options, parser;
parser = new OptionParser(switches, usage);
options = parser.parse(argv);
args = options.arguments;
delete options.arguments;
if (options.help || argv.length === 0) {
puts(parser.help());
}
... | @run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) -... | JavaScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 63 | 85 |
mauricemach/coffeekup:src/cli.coffee:4:completion | completion | @run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) -... | contents = fs.readFileSync file, 'utf-8'
coffeekup.render contents, options
if args.length > 0
file = args[0]
if options.watch
fs.watchFile file, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.size is prev.size and curr.mtime.getTime() is prev.mtime.getTime()
c... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | e8295b4efb0690747163b95bf1c6f265df68ffa1 | 1,245 | https://github.com/mauricemach/coffeekup/blob/e8295b4efb0690747163b95bf1c6f265df68ffa1/src/cli.coffee | 63 | 85 |
mauricemach/coffeekup:src/cli.coffee:4:raw_corpus | raw_corpus | @run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) -... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | b409d7dc2c3ad152f930db3803e3b51198eb3b3b | 1,245 | https://github.com/mauricemach/coffeekup/blob/b409d7dc2c3ad152f930db3803e3b51198eb3b3b/src/cli.coffee | 63 | 84 | ||
mauricemach/coffeekup:src/cli.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
... | this.run = function() {
var args, file, options, parser;
parser = new OptionParser(switches, usage);
options = parser.parse(argv);
args = options.arguments;
delete options.arguments;
if (options.help || argv.length === 0) {
puts(parser.help());
}
if (options.version) {
puts(coffeekup.version);
... | CoffeeScript | JavaScript | mauricemach/coffeekup | src/cli.coffee | MIT | b409d7dc2c3ad152f930db3803e3b51198eb3b3b | 1,245 | https://github.com/mauricemach/coffeekup/blob/b409d7dc2c3ad152f930db3803e3b51198eb3b3b/src/cli.coffee | 63 | 84 |
mauricemach/coffeekup:src/cli.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.run = function() {
var args, file, options, parser;
parser = new OptionParser(switches, usage);
options = parser.parse(argv);
args = options.arguments;
delete options.arguments;
if (options.help || argv.length === 0) {
puts(parser.help());
}
... | @run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) -... | JavaScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | b409d7dc2c3ad152f930db3803e3b51198eb3b3b | 1,245 | https://github.com/mauricemach/coffeekup/blob/b409d7dc2c3ad152f930db3803e3b51198eb3b3b/src/cli.coffee | 63 | 84 |
mauricemach/coffeekup:src/cli.coffee:4:completion | completion | @run = ->
parser = new OptionParser switches, usage
options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) -... | contents = fs.readFileSync file, 'utf-8'
coffeekup.render contents, options
if args.length > 0
file = args[0]
if options.watch
fs.watchFile file, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.size is prev.size and curr.mtime.getTime() is prev.mtime.getTime()
c... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | b409d7dc2c3ad152f930db3803e3b51198eb3b3b | 1,245 | https://github.com/mauricemach/coffeekup/blob/b409d7dc2c3ad152f930db3803e3b51198eb3b3b/src/cli.coffee | 63 | 84 |
mauricemach/coffeekup:src/cli.coffee:1:raw_corpus | raw_corpus | coffeekup = require './coffeekup'
fs = require 'fs'
path = require 'path'
puts = console.log
{OptionParser} = require 'coffee-script/lib/optparse'
argv = process.argv[2..]
options = null
handle_error = (err) -> console.log err.stack if err
render = (input_path, output_directory) ->
fs.readFile input_path, 'utf-8',... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | a8f3a93159ffba9996a700b74eac59062ac0ed34 | 1,245 | https://github.com/mauricemach/coffeekup/blob/a8f3a93159ffba9996a700b74eac59062ac0ed34/src/cli.coffee | 1 | 50 | ||
mauricemach/coffeekup:src/cli.coffee:1:completion | completion | coffeekup = require './coffeekup'
fs = require 'fs'
path = require 'path'
puts = console.log
{OptionParser} = require 'coffee-script/lib/optparse'
argv = process.argv[2..]
options = null
handle_error = (err) -> console.log err.stack if err
render = (input_path, output_directory) ->
fs.readFile input_path, 'utf-8',... | output_path = path.join dir, filename
html = ' ' if html.length <= 0
fs.writeFile output_path, html, (err) ->
handle_error err
puts html if options.print
puts "Compiled #{input_path}" if options.watch
usage = '''
Usage:
coffeekup [options] path/to/template.coffee
'''
switches = [
['-... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | a8f3a93159ffba9996a700b74eac59062ac0ed34 | 1,245 | https://github.com/mauricemach/coffeekup/blob/a8f3a93159ffba9996a700b74eac59062ac0ed34/src/cli.coffee | 1 | 50 |
mauricemach/coffeekup:src/cli.coffee:2:raw_corpus | raw_corpus | options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) ->
contents = fs.readFileSync file, 'utf-8'
c... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | a8f3a93159ffba9996a700b74eac59062ac0ed34 | 1,245 | https://github.com/mauricemach/coffeekup/blob/a8f3a93159ffba9996a700b74eac59062ac0ed34/src/cli.coffee | 51 | 70 | ||
mauricemach/coffeekup:src/cli.coffee:2:completion | completion | options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) ->
contents = fs.readFileSync file, 'utf-8' | coffeekup.render contents, options
if args.length > 0
file = args[0]
if options.watch
fs.watchFile file, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.size is prev.size and curr.mtime.getTime() is prev.mtime.getTime()
render file, options.output
else render file... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | a8f3a93159ffba9996a700b74eac59062ac0ed34 | 1,245 | https://github.com/mauricemach/coffeekup/blob/a8f3a93159ffba9996a700b74eac59062ac0ed34/src/cli.coffee | 51 | 70 |
mauricemach/coffeekup:src/cli.coffee:1:raw_corpus | raw_corpus | coffeekup = require './coffeekup'
fs = require 'fs'
path = require 'path'
puts = console.log
{OptionParser} = require 'coffee-script/lib/optparse'
argv = process.argv[2..]
options = null
handle_error = (err) -> console.log err.stack if err
render = (input_path, output_directory) ->
fs.readFile input_path, (err, co... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | 5fb9c390337e9867bb0e875384c31177ec013024 | 1,245 | https://github.com/mauricemach/coffeekup/blob/5fb9c390337e9867bb0e875384c31177ec013024/src/cli.coffee | 1 | 50 | ||
mauricemach/coffeekup:src/cli.coffee:1:completion | completion | coffeekup = require './coffeekup'
fs = require 'fs'
path = require 'path'
puts = console.log
{OptionParser} = require 'coffee-script/lib/optparse'
argv = process.argv[2..]
options = null
handle_error = (err) -> console.log err.stack if err
render = (input_path, output_directory) ->
fs.readFile input_path, (err, co... | output_path = path.join dir, filename
html = ' ' if html.length <= 0
fs.writeFile output_path, html, (err) ->
handle_error err
puts html if options.print
puts "Compiled #{input_path}" if options.watch
usage = '''
Usage:
coffeekup [options] path/to/template.coffee
'''
switches = [
['-... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | 5fb9c390337e9867bb0e875384c31177ec013024 | 1,245 | https://github.com/mauricemach/coffeekup/blob/5fb9c390337e9867bb0e875384c31177ec013024/src/cli.coffee | 1 | 50 |
mauricemach/coffeekup:src/cli.coffee:2:raw_corpus | raw_corpus | options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) ->
contents = fs.readFileSync file
coffeekup.... | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | 5fb9c390337e9867bb0e875384c31177ec013024 | 1,245 | https://github.com/mauricemach/coffeekup/blob/5fb9c390337e9867bb0e875384c31177ec013024/src/cli.coffee | 51 | 70 | ||
mauricemach/coffeekup:src/cli.coffee:2:completion | completion | options = parser.parse argv
args = options.arguments
delete options.arguments
puts parser.help() if options.help or argv.length is 0
puts coffeekup.version if options.version
if options.utils
options.locals ?= {}
options.locals.render = (file) ->
contents = fs.readFileSync file | coffeekup.render String(contents), options
if args.length > 0
file = args[0]
if options.watch
fs.watchFile file, {persistent: true, interval: 500}, (curr, prev) ->
return if curr.size is prev.size and curr.mtime.getTime() is prev.mtime.getTime()
render file, options.output
else ren... | CoffeeScript | CoffeeScript | mauricemach/coffeekup | src/cli.coffee | MIT | 5fb9c390337e9867bb0e875384c31177ec013024 | 1,245 | https://github.com/mauricemach/coffeekup/blob/5fb9c390337e9867bb0e875384c31177ec013024/src/cli.coffee | 51 | 70 |
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:1:raw_corpus | raw_corpus | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
rq = require 'request'
describe 'Union#Trello', ->
before util.prepare
it 'should redirect to trello account page when visit redirect url', (done) ->
reques... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
rq = require 'request'
describe 'Union#Trello', ->
before util.prepare
it 'should redirect to trello ac... | var app, jwt, request, rq, should, util;
should = require('should');
request = require('supertest');
jwt = require('jsonwebtoken');
app = require('../../../server/server');
util = require('../../util');
rq = require('request');
describe('Union#Trello', function() {
before(util.prepare);
it('should redirect t... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var app, jwt, request, rq, should, util;
should = require('should');
request = require('supertest');
jwt = require('jsonwebtoken');
app = require('../../../server/server');
util = require('../../util');
rq = require('request');
describe('Union#Trello', funct... | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
rq = require 'request'
describe 'Union#Trello', ->
before util.prepare
it 'should redirect to trello account page when visit redirect url', (done) ->
reques... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:1:completion | completion | should = require 'should'
request = require 'supertest'
jwt = require 'jsonwebtoken'
app = require '../../../server/server'
util = require '../../util'
rq = require 'request'
describe 'Union#Trello', ->
before util.prepare
it 'should redirect to trello account page when visit redirect url', (done) ->
reques... | oauth_token: 'trello_authorize_token_step_2'
oauth_verifier: 'trello_authorize_verifier_step_2'
util.request options, (err, res, user) ->
user.should.have.properties 'name', 'refer', 'openId', 'accountToken', 'wasNew', 'showname'
user.wasNew.should.eql true
user.name.should.eql 'trello 用户'... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 1 | 50 |
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:3:raw_corpus | raw_corpus | it 'should bind to an exist trello account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/trello'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'accountToke... | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 53 | 96 | ||
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should bind to an exist trello account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/trello'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res... | it('should bind to an exist trello account by bindCode', function(done) {
var options;
options = {
method: 'POST',
url: '/union/forcebind/trello',
body: {
accountToken: util.user.accountToken,
bindCode: util.bindCode
}
};
return util.request(options, function(err, res, user) {
us... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 53 | 96 |
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should bind to an exist trello account by bindCode', function(done) {
var options;
options = {
method: 'POST',
url: '/union/forcebind/trello',
body: {
accountToken: util.user.accountToken,
bindCode: util.bindCode
}
};
return ... | it 'should bind to an exist trello account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/trello'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'accountToke... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 53 | 96 |
jianliaoim/talk-os:talk-account/test/apis/unions/trello.coffee:3:completion | completion | it 'should bind to an exist trello account by bindCode', (done) ->
options =
method: 'POST'
url: '/union/forcebind/trello'
body:
accountToken: util.user.accountToken
bindCode: util.bindCode
util.request options, (err, res, user) ->
user.should.have.properties 'accountToke... | options =
method: 'POST'
url: '/union/bind/trello'
body:
accountToken: util.user.accountToken
oauth_token: 'trello_authorize_token_step_2'
oauth_verifier: 'trello_authorize_verifier_step_2'
util.request options, (err, res, user) ->
user.should.have.properties 'refer',... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/test/apis/unions/trello.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/test/apis/unions/trello.coffee | 53 | 96 |
jianliaoim/talk-os:talk-api2x/server/schemas/usage.coffee:1:raw_corpus | raw_corpus | ###*
* db.usages.createIndex({team: 1, type: 1, month: 1}, {unique: true, background: true})
###
mongoose = require 'mongoose'
util = require '../util'
{Schema} = mongoose
module.exports = UsageSchema = new Schema
amount: type: Number, default: 0
maxAmount: type: Number, default: 0, required: true
team: type:... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/schemas/usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/usage.coffee | 1 | 47 | ||
jianliaoim/talk-os:talk-api2x/server/schemas/usage.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###*
* db.usages.createIndex({team: 1, type: 1, month: 1}, {unique: true, background: true})
###
mongoose = require 'mongoose'
util = require '../util'
{Schema} = mongoose
module.exports = UsageSchema = new Schema
amount: type: Number, default: 0
maxAmoun... | /**
* db.usages.createIndex({team: 1, type: 1, month: 1}, {unique: true, background: true})
*/
var Schema, UsageSchema, mongoose, util;
mongoose = require('mongoose');
util = require('../util');
({Schema} = mongoose);
module.exports = UsageSchema = new Schema({
amount: {
type: Number,
default: 0
},
... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/schemas/usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/usage.coffee | 1 | 47 |
jianliaoim/talk-os:talk-api2x/server/schemas/usage.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/**
* db.usages.createIndex({team: 1, type: 1, month: 1}, {unique: true, background: true})
*/
var Schema, UsageSchema, mongoose, util;
mongoose = require('mongoose');
util = require('../util');
({Schema} = mongoose);
module.exports = UsageSchema = new Schema... | ###*
* db.usages.createIndex({team: 1, type: 1, month: 1}, {unique: true, background: true})
###
mongoose = require 'mongoose'
util = require '../util'
{Schema} = mongoose
module.exports = UsageSchema = new Schema
amount: type: Number, default: 0
maxAmount: type: Number, default: 0, required: true
team: type:... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/schemas/usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/usage.coffee | 1 | 47 |
jianliaoim/talk-os:talk-api2x/server/schemas/usage.coffee:1:completion | completion | ###*
* db.usages.createIndex({team: 1, type: 1, month: 1}, {unique: true, background: true})
###
mongoose = require 'mongoose'
util = require '../util'
{Schema} = mongoose
module.exports = UsageSchema = new Schema
amount: type: Number, default: 0
maxAmount: type: Number, default: 0, required: true
team: type:... | # ============ Virtuals ============
UsageSchema.virtual '_teamId'
.get -> @team?._id or @team
.set (_id) -> @team = _id
# ============ Methods ============
# ============ Statics ============
UsageSchema.statics.incr = (_teamId, type, incrAmount, callback) ->
UsageModel = this
month = util.getCurrentMonth()... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/schemas/usage.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/schemas/usage.coffee | 1 | 47 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
# Represents a single layer and all of the data associated with
# that layer. Typically you will access this data from a Node
# object, which simplifies access for you.
module.exports = class Layer extends Module
# Mixins for all of the various data each layer contains.
@in... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
# Represents a single layer and all of the data associated with
# that layer. Typically you will access this data from a Node
# object, which simplifies access for you.
module.exports = class Layer extends Module
# Mixins for all of the various data each layer contains.
@in... | # The layer's name can come from one of two places, depending on
# what version of Photoshop was used to create the PSD.
Object.defineProperty @, 'name',
get: ->
if @adjustments['name']?
@adjustments['name'].data
else
@legacyName
# Every layer starts with the same se... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/layer.coffee:2:raw_corpus | raw_corpus | return @
export: ->
name: @name
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer.coffee | 51 | 64 | ||
meltingice/psd.js:lib/psd/layer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return @
export: ->
name: @name
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export()
``` | return this({
export: function() {
return {
name: this.name,
top: this.top,
right: this.right,
bottom: this.bottom,
left: this.left,
width: this.width,
height: this.height,
opacity: this.opacity,
visible: this.visible,
clipped: this.clipped,
mask: ... | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer.coffee | 51 | 64 |
meltingice/psd.js:lib/psd/layer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
return this({
export: function() {
return {
name: this.name,
top: this.top,
right: this.right,
bottom: this.bottom,
left: this.left,
width: this.width,
height: this.height,
opacity: this.opacity,
visible: ... | return @
export: ->
name: @name
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer.coffee | 51 | 64 |
meltingice/psd.js:lib/psd/layer.coffee:2:completion | completion | return @
export: ->
name: @name
top: @top
right: @right
bottom: @bottom | left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer.coffee | 51 | 64 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
# Represents a single layer and all of the data associated with
# that layer. Typically you will access this data from a Node
# object, which simplifies access for you.
module.exports = class Layer extends Module
# Mixins for all of the various data each layer contains.
@in... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | e6f041259756b67021bcaf1136655263fe6c3c8a | 2,846 | https://github.com/meltingice/psd.js/blob/e6f041259756b67021bcaf1136655263fe6c3c8a/lib/psd/layer.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
# Represents a single layer and all of the data associated with
# that layer. Typically you will access this data from a Node
# object, which simplifies access for you.
module.exports = class Layer extends Module
# Mixins for all of the various data each layer contains.
@in... | Object.defineProperty @, 'name',
get: ->
if @adjustments['name']?
@adjustments['name'].data
else
@legacyName
parse: ->
@parsePositionAndChannels()
@parseBlendModes()
extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@pa... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | e6f041259756b67021bcaf1136655263fe6c3c8a | 2,846 | https://github.com/meltingice/psd.js/blob/e6f041259756b67021bcaf1136655263fe6c3c8a/lib/psd/layer.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/layer.coffee:2:raw_corpus | raw_corpus | top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | e6f041259756b67021bcaf1136655263fe6c3c8a | 2,846 | https://github.com/meltingice/psd.js/blob/e6f041259756b67021bcaf1136655263fe6c3c8a/lib/psd/layer.coffee | 51 | 60 | ||
meltingice/psd.js:lib/psd/layer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export()
``` | ({
top: this.top({
right: this.right,
bottom: this.bottom,
left: this.left,
width: this.width,
height: this.height,
opacity: this.opacity,
visible: this.visible,
clipped: this.clipped,
mask: this.mask.export()
})
}); | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | e6f041259756b67021bcaf1136655263fe6c3c8a | 2,846 | https://github.com/meltingice/psd.js/blob/e6f041259756b67021bcaf1136655263fe6c3c8a/lib/psd/layer.coffee | 51 | 60 |
meltingice/psd.js:lib/psd/layer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
top: this.top({
right: this.right,
bottom: this.bottom,
left: this.left,
width: this.width,
height: this.height,
opacity: this.opacity,
visible: this.visible,
clipped: this.clipped,
mask: this.mask.export()
})
});
``` | top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | e6f041259756b67021bcaf1136655263fe6c3c8a | 2,846 | https://github.com/meltingice/psd.js/blob/e6f041259756b67021bcaf1136655263fe6c3c8a/lib/psd/layer.coffee | 51 | 60 |
meltingice/psd.js:lib/psd/layer.coffee:2:completion | completion | top: @top
right: @right
bottom: @bottom
left: @left
width: @width | height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | e6f041259756b67021bcaf1136655263fe6c3c8a | 2,846 | https://github.com/meltingice/psd.js/blob/e6f041259756b67021bcaf1136655263fe6c3c8a/lib/psd/layer.coffee | 51 | 60 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | c895ffd782a64323324b3d744bb3bbbece05398f | 2,846 | https://github.com/meltingice/psd.js/blob/c895ffd782a64323324b3d744bb3bbbece05398f/lib/psd/layer.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | @adjustments['name'].data
else
@legacyName
parse: ->
@parsePositionAndChannels()
@parseBlendModes()
extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@parseBlendingRanges()
@parseLegacyLayerName()
@parseLayerInfo()
@file.seek @lay... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | c895ffd782a64323324b3d744bb3bbbece05398f | 2,846 | https://github.com/meltingice/psd.js/blob/c895ffd782a64323324b3d744bb3bbbece05398f/lib/psd/layer.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/layer.coffee:2:raw_corpus | raw_corpus | width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | c895ffd782a64323324b3d744bb3bbbece05398f | 2,846 | https://github.com/meltingice/psd.js/blob/c895ffd782a64323324b3d744bb3bbbece05398f/lib/psd/layer.coffee | 51 | 56 | ||
meltingice/psd.js:lib/psd/layer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export()
``` | ({
width: this.width({
height: this.height,
opacity: this.opacity,
visible: this.visible,
clipped: this.clipped,
mask: this.mask.export()
})
}); | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | c895ffd782a64323324b3d744bb3bbbece05398f | 2,846 | https://github.com/meltingice/psd.js/blob/c895ffd782a64323324b3d744bb3bbbece05398f/lib/psd/layer.coffee | 51 | 56 |
meltingice/psd.js:lib/psd/layer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
width: this.width({
height: this.height,
opacity: this.opacity,
visible: this.visible,
clipped: this.clipped,
mask: this.mask.export()
})
});
``` | width: @width
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | c895ffd782a64323324b3d744bb3bbbece05398f | 2,846 | https://github.com/meltingice/psd.js/blob/c895ffd782a64323324b3d744bb3bbbece05398f/lib/psd/layer.coffee | 51 | 56 |
meltingice/psd.js:lib/psd/layer.coffee:2:completion | completion | width: @width
height: @height
opacity: @opacity | visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | c895ffd782a64323324b3d744bb3bbbece05398f | 2,846 | https://github.com/meltingice/psd.js/blob/c895ffd782a64323324b3d744bb3bbbece05398f/lib/psd/layer.coffee | 51 | 56 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/layer.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | @adjustments['name'].data
else
@legacyName
parse: ->
@parsePositionAndChannels()
@parseBlendModes()
extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@parseBlendingRanges()
@parseLegacyLayerName()
@parseLayerInfo()
@file.seek @lay... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | aabb6de133eab9ae0a16981d0706fb83ce69fdba | 2,846 | https://github.com/meltingice/psd.js/blob/aabb6de133eab9ae0a16981d0706fb83ce69fdba/lib/psd/layer.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7ff90e8e15a9801da91d1e8b45ca662043526a26 | 2,846 | https://github.com/meltingice/psd.js/blob/7ff90e8e15a9801da91d1e8b45ca662043526a26/lib/psd/layer.coffee | 1 | 50 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | else
@legacyName
parse: ->
@parsePositionAndChannels()
@parseBlendModes()
extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@parseBlendingRanges()
@parseLegacyLayerName()
@parseLayerInfo()
@file.seek @layerEnd
return @
export: ->
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7ff90e8e15a9801da91d1e8b45ca662043526a26 | 2,846 | https://github.com/meltingice/psd.js/blob/7ff90e8e15a9801da91d1e8b45ca662043526a26/lib/psd/layer.coffee | 1 | 50 |
meltingice/psd.js:lib/psd/layer.coffee:2:raw_corpus | raw_corpus | height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7ff90e8e15a9801da91d1e8b45ca662043526a26 | 2,846 | https://github.com/meltingice/psd.js/blob/7ff90e8e15a9801da91d1e8b45ca662043526a26/lib/psd/layer.coffee | 51 | 55 | ||
meltingice/psd.js:lib/psd/layer.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export()
``` | ({
height: this.height({
opacity: this.opacity,
visible: this.visible,
clipped: this.clipped,
mask: this.mask.export()
})
}); | CoffeeScript | JavaScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7ff90e8e15a9801da91d1e8b45ca662043526a26 | 2,846 | https://github.com/meltingice/psd.js/blob/7ff90e8e15a9801da91d1e8b45ca662043526a26/lib/psd/layer.coffee | 51 | 55 |
meltingice/psd.js:lib/psd/layer.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
height: this.height({
opacity: this.opacity,
visible: this.visible,
clipped: this.clipped,
mask: this.mask.export()
})
});
``` | height: @height
opacity: @opacity
visible: @visible
clipped: @clipped
mask: @mask.export() | JavaScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7ff90e8e15a9801da91d1e8b45ca662043526a26 | 2,846 | https://github.com/meltingice/psd.js/blob/7ff90e8e15a9801da91d1e8b45ca662043526a26/lib/psd/layer.coffee | 51 | 55 |
meltingice/psd.js:lib/psd/layer.coffee:2:completion | completion | height: @height
opacity: @opacity | visible: @visible
clipped: @clipped
mask: @mask.export() | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 7ff90e8e15a9801da91d1e8b45ca662043526a26 | 2,846 | https://github.com/meltingice/psd.js/blob/7ff90e8e15a9801da91d1e8b45ca662043526a26/lib/psd/layer.coffee | 51 | 55 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 1bd1167c249ee8402f56c540910e27e68450e78e | 2,846 | https://github.com/meltingice/psd.js/blob/1bd1167c249ee8402f56c540910e27e68450e78e/lib/psd/layer.coffee | 1 | 48 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@parseBlendingRanges()
@parseLegacyLayerName()
@parseLayerInfo()
@file.seek @layerEnd
return @
export: ->
name: @name
top: @top
right: @right
bottom: @bottom
left: @left
width: @width... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 1bd1167c249ee8402f56c540910e27e68450e78e | 2,846 | https://github.com/meltingice/psd.js/blob/1bd1167c249ee8402f56c540910e27e68450e78e/lib/psd/layer.coffee | 1 | 48 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 28ac2075d7bad825fb58a2b269d9636ee382df4a | 2,846 | https://github.com/meltingice/psd.js/blob/28ac2075d7bad825fb58a2b269d9636ee382df4a/lib/psd/layer.coffee | 1 | 46 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
@includes require('./layer/na... | extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@parseBlendingRanges()
@parseLegacyLayerName()
@file.seek @layerEnd
return @
export: ->
name: @name
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 28ac2075d7bad825fb58a2b269d9636ee382df4a | 2,846 | https://github.com/meltingice/psd.js/blob/28ac2075d7bad825fb58a2b269d9636ee382df4a/lib/psd/layer.coffee | 1 | 46 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
# @includes require('./layer/... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 32ef374ac9a3d388d210a2d4e36207c9722b66a8 | 2,846 | https://github.com/meltingice/psd.js/blob/32ef374ac9a3d388d210a2d4e36207c9722b66a8/lib/psd/layer.coffee | 1 | 43 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
@includes require('./layer/blending_ranges.coffee')
# @includes require('./layer/... | @parseBlendModes()
extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@parseBlendingRanges()
@file.seek @layerEnd
return @
export: ->
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 32ef374ac9a3d388d210a2d4e36207c9722b66a8 | 2,846 | https://github.com/meltingice/psd.js/blob/32ef374ac9a3d388d210a2d4e36207c9722b66a8/lib/psd/layer.coffee | 1 | 43 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
# @includes require('./layer/blending_ranges.coffee')
# @includes require('./laye... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 9635f388b65db85620d774ecd8fd501a5e29f24d | 2,846 | https://github.com/meltingice/psd.js/blob/9635f388b65db85620d774ecd8fd501a5e29f24d/lib/psd/layer.coffee | 1 | 42 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
@includes require('./layer/mask.coffee')
# @includes require('./layer/blending_ranges.coffee')
# @includes require('./laye... | @parseBlendModes()
extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@parseMaskData()
@file.seek @layerEnd
return @
export: ->
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @visible
... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 9635f388b65db85620d774ecd8fd501a5e29f24d | 2,846 | https://github.com/meltingice/psd.js/blob/9635f388b65db85620d774ecd8fd501a5e29f24d/lib/psd/layer.coffee | 1 | 42 |
meltingice/psd.js:lib/psd/layer.coffee:1:raw_corpus | raw_corpus | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
# @includes require('./layer/blending_ranges.coffee')
# @includes require('./layer/channel_image.coffee')
constructor: (@... | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 565c4a6eef97b2ef26e76cd0910c3eb60b507434 | 2,846 | https://github.com/meltingice/psd.js/blob/565c4a6eef97b2ef26e76cd0910c3eb60b507434/lib/psd/layer.coffee | 1 | 38 | ||
meltingice/psd.js:lib/psd/layer.coffee:1:completion | completion | {Module} = require 'coffeescript-module'
module.exports = class Layer extends Module
@includes require('./layer/position_channels.coffee')
@includes require('./layer/blend_modes.coffee')
# @includes require('./layer/blending_ranges.coffee')
# @includes require('./layer/channel_image.coffee')
constructor: (@... | @parsePositionAndChannels()
@parseBlendModes()
extraLen = @file.readInt()
@layerEnd = @file.tell() + extraLen
@file.seek @layerEnd
return @
export: ->
top: @top
right: @right
bottom: @bottom
left: @left
width: @width
height: @height
opacity: @opacity
visible: @vi... | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer.coffee | MIT | 565c4a6eef97b2ef26e76cd0910c3eb60b507434 | 2,846 | https://github.com/meltingice/psd.js/blob/565c4a6eef97b2ef26e76cd0910c3eb60b507434/lib/psd/layer.coffee | 1 | 38 |
Nedomas/databound:src/databound.coffee:1:raw_corpus | raw_corpus | class Databound
constructor: (@endpoint, @scope = {}, @options = {}) ->
@extra_where_scopes = @options.extra_where_scopes or []
@records = []
@seeds = []
@properties = []
# ## Start of Configs
# Functions ``request`` and ``promise`` are overritable
Databound.API_URL = ""
# Does a POST reques... | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 16 | 65 | ||
Nedomas/databound:src/databound.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Databound
constructor: (@endpoint, @scope = {}, @options = {}) ->
@extra_where_scopes = @options.extra_where_scopes or []
@records = []
@seeds = []
@properties = []
# ## Start of Configs
# Functions ``request`` and ``promise`` are ove... | var Databound;
Databound = (function() {
class Databound {
constructor(endpoint, scope = {}, options = {}) {
this.endpoint = endpoint;
this.scope = scope;
this.options = options;
this.extra_where_scopes = this.options.extra_where_scopes || [];
this.records = [];
this.seeds = [... | CoffeeScript | JavaScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 16 | 65 |
Nedomas/databound:src/databound.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Databound;
Databound = (function() {
class Databound {
constructor(endpoint, scope = {}, options = {}) {
this.endpoint = endpoint;
this.scope = scope;
this.options = options;
this.extra_where_scopes = this.options.extra_where_scop... | class Databound
constructor: (@endpoint, @scope = {}, @options = {}) ->
@extra_where_scopes = @options.extra_where_scopes or []
@records = []
@seeds = []
@properties = []
# ## Start of Configs
# Functions ``request`` and ``promise`` are overritable
Databound.API_URL = ""
# Does a POST reques... | JavaScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 16 | 65 |
Nedomas/databound:src/databound.coffee:1:completion | completion | class Databound
constructor: (@endpoint, @scope = {}, @options = {}) ->
@extra_where_scopes = @options.extra_where_scopes or []
@records = []
@seeds = []
@properties = []
# ## Start of Configs
# Functions ``request`` and ``promise`` are overritable
Databound.API_URL = ""
# Does a POST reques... | @wrappedRequest('where', params).then (resp) ->
records = JSON.parse(resp.records).concat(_this.seeds)
_this.records = _.sortBy(records, 'id')
_this.promise _this.records
all: ->
@where()
# Return a single record by ``id``
#
# ```coffeescript
# User.find(15).then (user) ->
# alert ... | CoffeeScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 16 | 65 |
Nedomas/databound:src/databound.coffee:2:raw_corpus | raw_corpus | # Return a single record by ``params``
#
# ```coffeescript
# User.findBy(name: 'John', city: 'New York').then (user) ->
# alert "I'm John from New York"
# ```
findBy: (params) ->
_this = @
@where(params).then (resp) ->
_this.promise _.first(_.values(resp))
create: (params) ->
@reques... | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 66 | 115 | ||
Nedomas/databound:src/databound.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Return a single record by ``params``
#
# ```coffeescript
# User.findBy(name: 'John', city: 'New York').then (user) ->
# alert "I'm John from New York"
# ```
findBy: (params) ->
_this = @
@where(params).then (resp) ->
_this.promise _... | // Return a single record by ``params``
// ```coffeescript
// User.findBy(name: 'John', city: 'New York').then (user) ->
// alert "I'm John from New York"
// ```
({
findBy: function(params) {
var _this;
_this = this;
return this.where(params).then(function(resp) {
return _this.promise(_.first(_.v... | CoffeeScript | JavaScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 66 | 115 |
Nedomas/databound:src/databound.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Return a single record by ``params``
// ```coffeescript
// User.findBy(name: 'John', city: 'New York').then (user) ->
// alert "I'm John from New York"
// ```
({
findBy: function(params) {
var _this;
_this = this;
return this.where(params).then(... | # Return a single record by ``params``
#
# ```coffeescript
# User.findBy(name: 'John', city: 'New York').then (user) ->
# alert "I'm John from New York"
# ```
findBy: (params) ->
_this = @
@where(params).then (resp) ->
_this.promise _.first(_.values(resp))
create: (params) ->
@reques... | JavaScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 66 | 115 |
Nedomas/databound:src/databound.coffee:2:completion | completion | # Return a single record by ``params``
#
# ```coffeescript
# User.findBy(name: 'John', city: 'New York').then (user) ->
# alert "I'm John from New York"
# ```
findBy: (params) ->
_this = @
@where(params).then (resp) ->
_this.promise _.first(_.values(resp))
create: (params) ->
@reques... | # alert resp.success
# ```
update: (params) ->
@requestAndRefresh 'update', params
destroy: (id) ->
@checkUndefinedId('destroy', id)
@requestAndRefresh 'destroy', id: id
# Just take already dowloaded records
take: (id) ->
_.detect @records, (record) ->
id.toString() == record.id.to... | CoffeeScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 66 | 115 |
Nedomas/databound:src/databound.coffee:3:raw_corpus | raw_corpus | #
# ```javascript
# {
# success: true,
# id: record.id,
# scoped_records: []
# }
# ```
@wrappedRequest(action, params).then (resp) ->
records = JSON.parse(resp.scoped_records)
records_with_seeds = records.concat(_this.seeds)
_this.records = _.sortBy(reco... | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 116 | 162 | ||
Nedomas/databound:src/databound.coffee:3:completion | completion | #
# ```javascript
# {
# success: true,
# id: record.id,
# scoped_records: []
# }
# ```
@wrappedRequest(action, params).then (resp) ->
records = JSON.parse(resp.scoped_records)
records_with_seeds = records.concat(_this.seeds)
_this.records = _.sortBy(reco... | data: (params) ->
scope: JSON.stringify(@scope)
extra_where_scopes: JSON.stringify(@extra_where_scopes)
data: JSON.stringify(params)
wrappedRequest: (args...) ->
@request(args...).then(_.bind(@handleSuccess, @)).fail(@handleFailure)
handleSuccess: (resp) ->
throw new Error 'Error in the backen... | CoffeeScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 116 | 162 |
Nedomas/databound:src/databound.coffee:4:raw_corpus | raw_corpus | class DataboundError
constructor: (text) ->
@message = "Databound: #{text}"
@STATUS: 405
DataboundError:: = new Error() | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 164 | 170 | ||
Nedomas/databound:src/databound.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class DataboundError
constructor: (text) ->
@message = "Databound: #{text}"
@STATUS: 405
DataboundError:: = new Error()
``` | var DataboundError;
DataboundError = (function() {
class DataboundError {
constructor(text) {
this.message = `Databound: ${text}`;
}
};
DataboundError.STATUS = 405;
return DataboundError;
}).call(this);
DataboundError.prototype = new Error(); | CoffeeScript | JavaScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 164 | 170 |
Nedomas/databound:src/databound.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var DataboundError;
DataboundError = (function() {
class DataboundError {
constructor(text) {
this.message = `Databound: ${text}`;
}
};
DataboundError.STATUS = 405;
return DataboundError;
}).call(this);
DataboundError.prototype = new Err... | class DataboundError
constructor: (text) ->
@message = "Databound: #{text}"
@STATUS: 405
DataboundError:: = new Error() | JavaScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 164 | 170 |
Nedomas/databound:src/databound.coffee:4:completion | completion | class DataboundError
constructor: (text) ->
@message = "Databound: #{text}" | @STATUS: 405
DataboundError:: = new Error() | CoffeeScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | a02f231f1c3964eb8584adf55d7709b656e7e4a4 | 452 | https://github.com/Nedomas/databound/blob/a02f231f1c3964eb8584adf55d7709b656e7e4a4/src/databound.coffee | 164 | 170 |
Nedomas/databound:src/databound.coffee:3:raw_corpus | raw_corpus | #
# ```javascript
# {
# success: true,
# id: record.id,
# scoped_records: []
# }
# ```
@wrappedRequest(action, params).then (resp) ->
records = JSON.parse(resp.scoped_records)
records_with_seeds = records.concat(_this.seeds)
_this.records = _.sortBy(reco... | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | 53f29f1c9ac0d7c89f83c9d56056dfe48b2202b2 | 452 | https://github.com/Nedomas/databound/blob/53f29f1c9ac0d7c89f83c9d56056dfe48b2202b2/src/databound.coffee | 116 | 162 | ||
Nedomas/databound:src/databound.coffee:3:completion | completion | #
# ```javascript
# {
# success: true,
# id: record.id,
# scoped_records: []
# }
# ```
@wrappedRequest(action, params).then (resp) ->
records = JSON.parse(resp.scoped_records)
records_with_seeds = records.concat(_this.seeds)
_this.records = _.sortBy(reco... | data: (params) ->
scope: JSON.stringify(@scope)
extra_where_scopes: JSON.stringify(@extra_where_scopes)
data: JSON.stringify(params)
wrappedRequest: (args...) ->
@request(args...).then(@handleSuccess).fail(@handleFailure)
handleSuccess: (resp) ->
throw new Error 'Error in the backend' unless r... | CoffeeScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | 53f29f1c9ac0d7c89f83c9d56056dfe48b2202b2 | 452 | https://github.com/Nedomas/databound/blob/53f29f1c9ac0d7c89f83c9d56056dfe48b2202b2/src/databound.coffee | 116 | 162 |
Nedomas/databound:src/databound.coffee:3:raw_corpus | raw_corpus | #
# ```javascript
# {
# success: true,
# id: record.id,
# scoped_records: []
# }
# ```
@wrappedRequest(action, params).then (resp) ->
records = JSON.parse(resp.scoped_records)
records_with_seeds = records.concat(_this.seeds)
_this.records = _.sortBy(reco... | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | 5eead32708a5601ade8a110b12b4e5726d4de2d6 | 452 | https://github.com/Nedomas/databound/blob/5eead32708a5601ade8a110b12b4e5726d4de2d6/src/databound.coffee | 116 | 162 | ||
Nedomas/databound:src/databound.coffee:3:completion | completion | #
# ```javascript
# {
# success: true,
# id: record.id,
# scoped_records: []
# }
# ```
@wrappedRequest(action, params).then (resp) ->
records = JSON.parse(resp.scoped_records)
records_with_seeds = records.concat(_this.seeds)
_this.records = _.sortBy(reco... | data: (params) ->
scope: JSON.stringify(@scope)
extra_where_scopes: JSON.stringify(@extra_where_scopes)
data: JSON.stringify(params)
wrappedRequest: (args...) ->
@request(args...).then(@handleSuccess).fail(@handleFailure)
handleSuccess: (resp) ->
throw new Error 'Error in the backend' unless r... | CoffeeScript | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | 5eead32708a5601ade8a110b12b4e5726d4de2d6 | 452 | https://github.com/Nedomas/databound/blob/5eead32708a5601ade8a110b12b4e5726d4de2d6/src/databound.coffee | 116 | 162 |
Nedomas/databound:src/databound.coffee:4:raw_corpus | raw_corpus | class DataboundError
constructor: (text) ->
@message = "Databound: #{text}"
DataboundError:: = new Error() | CoffeeScript | Nedomas/databound | src/databound.coffee | MIT | 5eead32708a5601ade8a110b12b4e5726d4de2d6 | 452 | https://github.com/Nedomas/databound/blob/5eead32708a5601ade8a110b12b4e5726d4de2d6/src/databound.coffee | 164 | 168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.