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
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:3:completion
completion
# Data Source (re)loaded $scope.$on 'dataSource:' + dsDefinition.name + ':data', (event, eventData) -> return unless eventData.version > $scope.dataVersion $scope.dataVersion = eventData.version $scope.dataSourceData = eventData.data[dsDefiniti...
# Initialize the Data Source $scope.dataSource.init dsDefinition return }
CoffeeScript
CoffeeScript
ExpediaGroup/cyclotron
cyclotron-site/app/widgets/header/directives.headerParameter.coffee
MIT
0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab
1,544
https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/header/directives.headerParameter.coffee
83
95
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:1:raw_corpus
raw_corpus
### # Copyright (c) 2016 the original author or authors. # # Licensed under the MIT License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.opensource.org/licenses/mit-license.php # # Unless required by applicable law or ag...
CoffeeScript
ExpediaGroup/cyclotron
cyclotron-site/app/widgets/header/directives.headerParameter.coffee
MIT
a12c9001e20a5c1fb0813bedb7b1a88dd7791019
1,544
https://github.com/ExpediaGroup/cyclotron/blob/a12c9001e20a5c1fb0813bedb7b1a88dd7791019/cyclotron-site/app/widgets/header/directives.headerParameter.coffee
1
39
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:1:completion
completion
### # Copyright (c) 2016 the original author or authors. # # Licensed under the MIT License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.opensource.org/licenses/mit-license.php # # Unless required by applicable law or ag...
scope: dashboard: '=' parameterDefinition: '=' replace: true templateUrl: '/widgets/header/headerParameter.html' controller: ($scope) -> originalValue = $window.Cyclotron.parameters[$scope.parameterDefinition.name] $scope.parameter = ...
CoffeeScript
CoffeeScript
ExpediaGroup/cyclotron
cyclotron-site/app/widgets/header/directives.headerParameter.coffee
MIT
a12c9001e20a5c1fb0813bedb7b1a88dd7791019
1,544
https://github.com/ExpediaGroup/cyclotron/blob/a12c9001e20a5c1fb0813bedb7b1a88dd7791019/cyclotron-site/app/widgets/header/directives.headerParameter.coffee
1
39
jianliaoim/talk-os:talk-web/client/app/viewer-footer.coffee:1:raw_corpus
raw_corpus
React = require 'react' Immutable = require 'immutable' recorder = require 'actions-recorder' PureRenderMixin = require 'react-addons-pure-render-mixin' ContactName = React.createFactory require './contact-name' MessageToolbar = React.createFactory require './message-toolbar' UserAlias = React.createFactory requir...
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/viewer-footer.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/viewer-footer.coffee
1
50
jianliaoim/talk-os:talk-web/client/app/viewer-footer.coffee:1:completion
completion
React = require 'react' Immutable = require 'immutable' recorder = require 'actions-recorder' PureRenderMixin = require 'react-addons-pure-render-mixin' ContactName = React.createFactory require './contact-name' MessageToolbar = React.createFactory require './message-toolbar' UserAlias = React.createFactory requir...
propTypes: isFavorite: T.bool canEdit: T.bool message: T.instanceOf(Immutable.Map) getDefaultProps: -> canEdit: true isFavorite: false renderChannel: -> _userId = query.userId(recorder.getState()) switch @props.message.get('type') when 'room' span null, UserAli...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/viewer-footer.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/viewer-footer.coffee
1
50
jianliaoim/talk-os:talk-web/client/app/viewer-footer.coffee:2:raw_corpus
raw_corpus
story = @props.message.get('story') span null, UserAlias _teamId: @props.message.get('_teamId') _userId: @props.message.get('_creatorId') defaultName: @props.message.getIn(['creator', 'name']) replaceMe: true span className: 'arrow-right', null...
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/viewer-footer.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/viewer-footer.coffee
51
70
jianliaoim/talk-os:talk-web/client/app/viewer-footer.coffee:2:completion
completion
story = @props.message.get('story') span null, UserAlias _teamId: @props.message.get('_teamId') _userId: @props.message.get('_creatorId') defaultName: @props.message.getIn(['creator', 'name']) replaceMe: true span className: 'arrow-right', null...
render: -> message = @props.message div className: 'viewer-footer', div className: 'info', @renderChannel() lang.getText('comma') RelativeTime data: message.get('createdAt'), edited: message.get('updatedAt') unless @props.isFavorite MessageToolbar message: message, h...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/viewer-footer.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/viewer-footer.coffee
51
70
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> grunt.config.init compass: example: options: sassDir: 'example' cssDir: 'example' outputStyle: 'compressed' src: options: sassDir: 'src' ...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
521099b060370087e587945e9c29eeb79023bfee
600
https://github.com/kelp404/angular-form-builder/blob/521099b060370087e587945e9c29eeb79023bfee/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = (grunt) -> grunt.config.init compass: example: options: sassDir: 'example' cssDir: 'example' outputStyle: 'compressed' src: ...
module.exports = function(grunt) { return grunt.config.init({ compass: { example: { options: { sassDir: 'example', cssDir: 'example', outputStyle: 'compressed' } }, src: { options: { sassDir: 'src', cssDir: 'dist', ...
CoffeeScript
JavaScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
521099b060370087e587945e9c29eeb79023bfee
600
https://github.com/kelp404/angular-form-builder/blob/521099b060370087e587945e9c29eeb79023bfee/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript module.exports = function(grunt) { return grunt.config.init({ compass: { example: { options: { sassDir: 'example', cssDir: 'example', outputStyle: 'compressed' } }, src: { options: { ...
module.exports = (grunt) -> grunt.config.init compass: example: options: sassDir: 'example' cssDir: 'example' outputStyle: 'compressed' src: options: sassDir: 'src' ...
JavaScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
521099b060370087e587945e9c29eeb79023bfee
600
https://github.com/kelp404/angular-form-builder/blob/521099b060370087e587945e9c29eeb79023bfee/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> grunt.config.init compass: example: options: sassDir: 'example' cssDir: 'example' outputStyle: 'compressed' src: options: sassDir: 'src' ...
uglify: build: files: 'dist/angular-form-builder.min.js': 'dist/angular-form-builder.js' 'dist/angular-form-builder-components.min.js': 'dist/angular-form-builder-components.js' watch: compass: files: ['example/*.sc...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
521099b060370087e587945e9c29eeb79023bfee
600
https://github.com/kelp404/angular-form-builder/blob/521099b060370087e587945e9c29eeb79023bfee/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: 'example' cssDir: 'example' outputStyle:...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
bf60a15e6ae1cef3c56cb588d421395d03eba4c6
600
https://github.com/kelp404/angular-form-builder/blob/bf60a15e6ae1cef3c56cb588d421395d03eba4c6/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: 'example' cssDir: 'example' outputStyle:...
files: 'example/demo.js': 'example/demo.coffee' watch: compass: files: ['example/*.scss', 'src/*.scss'] tasks: ['compass'] options: spawn: no coffee: files: ['src/*.coffee', 'componen...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
bf60a15e6ae1cef3c56cb588d421395d03eba4c6
600
https://github.com/kelp404/angular-form-builder/blob/bf60a15e6ae1cef3c56cb588d421395d03eba4c6/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
428525347e7d60c119a374157a658c016adb2e44
600
https://github.com/kelp404/angular-form-builder/blob/428525347e7d60c119a374157a658c016adb2e44/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
files: './example/demo.js': './example/demo.coffee' watch: compass: files: ['./example/*.scss', './src/*.scss'] tasks: ['compass'] options: spawn: no coffee: files: ['./src/*.coffee',...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
428525347e7d60c119a374157a658c016adb2e44
600
https://github.com/kelp404/angular-form-builder/blob/428525347e7d60c119a374157a658c016adb2e44/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
f502c6fb8aa88574b23710afcc4b9dbdc9d51a52
600
https://github.com/kelp404/angular-form-builder/blob/f502c6fb8aa88574b23710afcc4b9dbdc9d51a52/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
files: './example/demo.js': './example/demo.coffee' watch: compass: files: ['./example/*.scss', './src/*.scss'] tasks: ['compass'] options: spawn: no coffee: files: ['./src/*.coffee',...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
f502c6fb8aa88574b23710afcc4b9dbdc9d51a52
600
https://github.com/kelp404/angular-form-builder/blob/f502c6fb8aa88574b23710afcc4b9dbdc9d51a52/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
3ea57f9aaf487018a395c5963d1a33b3445eca9c
600
https://github.com/kelp404/angular-form-builder/blob/3ea57f9aaf487018a395c5963d1a33b3445eca9c/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
files: './example/demo.js': './example/demo.coffee' watch: compass: files: ['./example/*.scss', './src/*.scss'] tasks: ['compass'] options: spawn: false coffee: files: ['./src/*.coffe...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
3ea57f9aaf487018a395c5963d1a33b3445eca9c
600
https://github.com/kelp404/angular-form-builder/blob/3ea57f9aaf487018a395c5963d1a33b3445eca9c/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
dd8f666598e663b3a624a376e5a64ba620ceb19c
600
https://github.com/kelp404/angular-form-builder/blob/dd8f666598e663b3a624a376e5a64ba620ceb19c/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
files: './example/demo.js': './example/demo.coffee' watch: compass: files: ['./example/*.scss', './src/*.scss'] tasks: ['compass'] options: spawn: false coffee: files: ['./src/*.coffe...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
dd8f666598e663b3a624a376e5a64ba620ceb19c
600
https://github.com/kelp404/angular-form-builder/blob/dd8f666598e663b3a624a376e5a64ba620ceb19c/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
0f15f30420e22797ae09c0f8daf739babaceb5a4
600
https://github.com/kelp404/angular-form-builder/blob/0f15f30420e22797ae09c0f8daf739babaceb5a4/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' ...
module.exports = function(grunt) { // ----------------------------------- // Options // ----------------------------------- return grunt.config.init({ compass: { example: { options: { sassDir: './example', cssDir: './example', outputStyle: 'compressed' } ...
CoffeeScript
JavaScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
0f15f30420e22797ae09c0f8daf739babaceb5a4
600
https://github.com/kelp404/angular-form-builder/blob/0f15f30420e22797ae09c0f8daf739babaceb5a4/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript module.exports = function(grunt) { // ----------------------------------- // Options // ----------------------------------- return grunt.config.init({ compass: { example: { options: { sassDir: './example', cssDir: './ex...
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
JavaScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
0f15f30420e22797ae09c0f8daf739babaceb5a4
600
https://github.com/kelp404/angular-form-builder/blob/0f15f30420e22797ae09c0f8daf739babaceb5a4/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: example: options: sassDir: './example' cssDir: './example' outputSt...
watch: compass: files: ['./example/*.scss', './src/*.scss'] tasks: ['compass'] options: spawn: false coffee: files: ['./src/*.coffee', './example/*.coffee'] tasks: ['coffee'] optio...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
0f15f30420e22797ae09c0f8daf739babaceb5a4
600
https://github.com/kelp404/angular-form-builder/blob/0f15f30420e22797ae09c0f8daf739babaceb5a4/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:raw_corpus
raw_corpus
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: dev: options: sassDir: './example' cssDir: './example' outputStyle:...
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
931e100813846ed1776ec67e7e873d85a8554843
600
https://github.com/kelp404/angular-form-builder/blob/931e100813846ed1776ec67e7e873d85a8554843/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: dev: options: sassDir: './example' ...
module.exports = function(grunt) { // ----------------------------------- // Options // ----------------------------------- grunt.config.init({ compass: { dev: { options: { sassDir: './example', cssDir: './example', outputStyle: 'compressed' } } ...
CoffeeScript
JavaScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
931e100813846ed1776ec67e7e873d85a8554843
600
https://github.com/kelp404/angular-form-builder/blob/931e100813846ed1776ec67e7e873d85a8554843/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript module.exports = function(grunt) { // ----------------------------------- // Options // ----------------------------------- grunt.config.init({ compass: { dev: { options: { sassDir: './example', cssDir: './example', ...
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: dev: options: sassDir: './example' cssDir: './example' outputStyle:...
JavaScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
931e100813846ed1776ec67e7e873d85a8554843
600
https://github.com/kelp404/angular-form-builder/blob/931e100813846ed1776ec67e7e873d85a8554843/Gruntfile.coffee
1
50
kelp404/angular-form-builder:Gruntfile.coffee:1:completion
completion
module.exports = (grunt) -> # ----------------------------------- # Options # ----------------------------------- grunt.config.init compass: dev: options: sassDir: './example' cssDir: './example' outputStyle:...
options: spawn: false coffee: files: ['./src/*.coffee', './example/*.coffee'] tasks: ['coffee'] options: spawn: false connect: server: options: protocol: 'http' ...
CoffeeScript
CoffeeScript
kelp404/angular-form-builder
Gruntfile.coffee
MIT
931e100813846ed1776ec67e7e873d85a8554843
600
https://github.com/kelp404/angular-form-builder/blob/931e100813846ed1776ec67e7e873d85a8554843/Gruntfile.coffee
1
50
buttercoin/buttercoin:lib/datastore/book.coffee:1:raw_corpus
raw_corpus
joinQueues = (front, back, withCb) -> withCb ||= (x) -> x until back.isEmpty() front.push withCb(back.shift())
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
5
8
buttercoin/buttercoin:lib/datastore/book.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript joinQueues = (front, back, withCb) -> withCb ||= (x) -> x until back.isEmpty() front.push withCb(back.shift()) ```
var joinQueues; joinQueues = function(front, back, withCb) { var results; withCb || (withCb = function(x) { return x; }); results = []; while (!back.isEmpty()) { results.push(front.push(withCb(back.shift()))); } return results; };
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
5
8
buttercoin/buttercoin:lib/datastore/book.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var joinQueues; joinQueues = function(front, back, withCb) { var results; withCb || (withCb = function(x) { return x; }); results = []; while (!back.isEmpty()) { results.push(front.push(withCb(back.shift()))); } return results; }; ```
joinQueues = (front, back, withCb) -> withCb ||= (x) -> x until back.isEmpty() front.push withCb(back.shift())
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
5
8
buttercoin/buttercoin:lib/datastore/book.coffee:1:completion
completion
joinQueues = (front, back, withCb) -> withCb ||= (x) -> x
until back.isEmpty() front.push withCb(back.shift())
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
5
8
buttercoin/buttercoin:lib/datastore/book.coffee:2:raw_corpus
raw_corpus
mkCloseOrder = (order) -> { status: 'success' kind: 'order_filled' order: order }
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
10
14
buttercoin/buttercoin:lib/datastore/book.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript mkCloseOrder = (order) -> { status: 'success' kind: 'order_filled' order: order } ```
var mkCloseOrder; mkCloseOrder = function(order) { return { status: 'success', kind: 'order_filled', order: order }; };
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
10
14
buttercoin/buttercoin:lib/datastore/book.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var mkCloseOrder; mkCloseOrder = function(order) { return { status: 'success', kind: 'order_filled', order: order }; }; ```
mkCloseOrder = (order) -> { status: 'success' kind: 'order_filled' order: order }
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
10
14
buttercoin/buttercoin:lib/datastore/book.coffee:3:raw_corpus
raw_corpus
mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled residual_order: remaining original_order: original_order } # BookStore provides an abstract interface for managing price levels. # It's primary goal is to make it easier to swap sto...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
16
28
buttercoin/buttercoin:lib/datastore/book.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled residual_order: remaining original_order: original_order } # BookStore provides an abstract interface for managing price lev...
var mkPartialOrder; mkPartialOrder = function(original_order, filled, remaining) { return { status: 'success', kind: 'order_partially_filled', filled_order: filled, residual_order: remaining, original_order: original_order }; }; // BookStore provides an abstract interface for managing price le...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
16
28
buttercoin/buttercoin:lib/datastore/book.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var mkPartialOrder; mkPartialOrder = function(original_order, filled, remaining) { return { status: 'success', kind: 'order_partially_filled', filled_order: filled, residual_order: remaining, original_order: original_order }; }; // BookSto...
mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled residual_order: remaining original_order: original_order } # BookStore provides an abstract interface for managing price levels. # It's primary goal is to make it easier to swap sto...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
16
28
buttercoin/buttercoin:lib/datastore/book.coffee:4:raw_corpus
raw_corpus
class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @insert(price, level) level.orders.push(order) level....
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
29
67
buttercoin/buttercoin:lib/datastore/book.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @inse...
var BookStore; BookStore = class BookStore { constructor() { this.add_to_price_level = this.add_to_price_level.bind(this); // TODO - optimize this to allow for halting this.for_levels_above = this.for_levels_above.bind(this); this.insert = this.insert.bind(this); this.delete = this.delete.bind(th...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
29
67
buttercoin/buttercoin:lib/datastore/book.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var BookStore; BookStore = class BookStore { constructor() { this.add_to_price_level = this.add_to_price_level.bind(this); // TODO - optimize this to allow for halting this.for_levels_above = this.for_levels_above.bind(this); this.insert = this.i...
class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @insert(price, level) level.orders.push(order) level....
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
29
67
buttercoin/buttercoin:lib/datastore/book.coffee:4:completion
completion
class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @insert(price, level) level.orders.push(order) level....
# TODO - optimize this to allow for halting for_levels_above: (price, cb) => cursor = @tree.range(0, price) running = true cursor.forEach (order_level, cur_price) => running = cb(cur_price, order_level) if running insert: (price, level) => @tree.insert(price, level) @size += 1 delete: ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
29
67
buttercoin/buttercoin:lib/datastore/book.coffee:5:raw_corpus
raw_corpus
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount amount_spent = 0 ...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount...
var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, amount_spent, closed, orig_order, results; orig_order = order; order = order...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, amount_spent, closed, orig_or...
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount amount_spent = 0 ...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:5:completion
completion
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount amount_spent = 0 ...
return true # want more price levels else # consume all orders we can at this price level, starting with the oldest cur_order = order_level.orders.shift() while cur_order?.offered_amount <= amount_remaining amount_filled += cur_order.offered_amount amount_remaining -= c...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:6:raw_corpus
raw_corpus
amount_filled += amount_remaining amount_spent += amount_remaining * price amount_remaining = 0 # push the partially filled order back to the front of the queue order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialO...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
120
168
buttercoin/buttercoin:lib/datastore/book.coffee:6:completion
completion
amount_filled += amount_remaining amount_spent += amount_remaining * price amount_remaining = 0 # push the partially filled order back to the front of the queue order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialO...
} else # TODO - move to Order? filled = new Order(order.account, order.offered_currency, amount_spent, order.received_currency, amount_filled) remaining = new Order(order.account, ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e
663
https://github.com/buttercoin/buttercoin/blob/2ae4a864831fa24094b74f9b0d1bcdeb0070bc2e/lib/datastore/book.coffee
120
168
buttercoin/buttercoin:lib/datastore/book.coffee:5:raw_corpus
raw_corpus
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount amount_spent = 0 ...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
039a369df1182d99533400e602c31b76c925563e
663
https://github.com/buttercoin/buttercoin/blob/039a369df1182d99533400e602c31b76c925563e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount...
var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, amount_spent, closed, orig_order, results; orig_order = order; order = order...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
039a369df1182d99533400e602c31b76c925563e
663
https://github.com/buttercoin/buttercoin/blob/039a369df1182d99533400e602c31b76c925563e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, amount_spent, closed, orig_or...
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount amount_spent = 0 ...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
039a369df1182d99533400e602c31b76c925563e
663
https://github.com/buttercoin/buttercoin/blob/039a369df1182d99533400e602c31b76c925563e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:5:completion
completion
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount amount_spent = 0 ...
return true # want more price levels else # consume all orders we can at this price level, starting with the oldest cur_order = order_level.orders.shift() while cur_order?.offered_amount <= amount_remaining amount_filled += cur_order.amount amount_remaining -= cur_order...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
039a369df1182d99533400e602c31b76c925563e
663
https://github.com/buttercoin/buttercoin/blob/039a369df1182d99533400e602c31b76c925563e/lib/datastore/book.coffee
70
119
buttercoin/buttercoin:lib/datastore/book.coffee:6:raw_corpus
raw_corpus
# push the partially filled order back to the front of the queue order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialOrder(cur_order, filled, remaining) return false # don't want more price levels closed.forEach (x) => joinQue...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
039a369df1182d99533400e602c31b76c925563e
663
https://github.com/buttercoin/buttercoin/blob/039a369df1182d99533400e602c31b76c925563e/lib/datastore/book.coffee
120
165
buttercoin/buttercoin:lib/datastore/book.coffee:6:completion
completion
# push the partially filled order back to the front of the queue order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialOrder(cur_order, filled, remaining) return false # don't want more price levels closed.forEach (x) => joinQue...
# TODO - move to Order? filled = new Order(order.account, order.offered_currency, amount_spent, order.received_currency, amount_filled) remaining = new Order(order.account, order.offer...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
039a369df1182d99533400e602c31b76c925563e
663
https://github.com/buttercoin/buttercoin/blob/039a369df1182d99533400e602c31b76c925563e/lib/datastore/book.coffee
120
165
buttercoin/buttercoin:lib/datastore/book.coffee:6:raw_corpus
raw_corpus
# push the partially filled order back to the front of the queue order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialOrder(cur_order, filled, remaining) return false # don't want more price levels closed.forEach (x) => joinQue...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
ab9f53ec6f19813648ed1045d67cbceff6ca5ab9
663
https://github.com/buttercoin/buttercoin/blob/ab9f53ec6f19813648ed1045d67cbceff6ca5ab9/lib/datastore/book.coffee
120
165
buttercoin/buttercoin:lib/datastore/book.coffee:6:completion
completion
# push the partially filled order back to the front of the queue order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialOrder(cur_order, filled, remaining) return false # don't want more price levels closed.forEach (x) => joinQue...
# TODO - move to Order? filled = new Order(order.account, order.offered_currency, amount_spent, order.received_currency, amount_filled) remaining = new Order(order.account, order.offer...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
ab9f53ec6f19813648ed1045d67cbceff6ca5ab9
663
https://github.com/buttercoin/buttercoin/blob/ab9f53ec6f19813648ed1045d67cbceff6ca5ab9/lib/datastore/book.coffee
120
165
buttercoin/buttercoin:lib/datastore/book.coffee:5:raw_corpus
raw_corpus
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount results = new DQ.D...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
9a339e9b5145ff37fd81139aed77ff810a94f13c
663
https://github.com/buttercoin/buttercoin/blob/9a339e9b5145ff37fd81139aed77ff810a94f13c/lib/datastore/book.coffee
69
118
buttercoin/buttercoin:lib/datastore/book.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount...
var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, closed, orig_order, results; orig_order = order; order = order.clone(); ...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
9a339e9b5145ff37fd81139aed77ff810a94f13c
663
https://github.com/buttercoin/buttercoin/blob/9a339e9b5145ff37fd81139aed77ff810a94f13c/lib/datastore/book.coffee
69
118
buttercoin/buttercoin:lib/datastore/book.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, closed, orig_order, results; ...
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount results = new DQ.D...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
9a339e9b5145ff37fd81139aed77ff810a94f13c
663
https://github.com/buttercoin/buttercoin/blob/9a339e9b5145ff37fd81139aed77ff810a94f13c/lib/datastore/book.coffee
69
118
buttercoin/buttercoin:lib/datastore/book.coffee:5:completion
completion
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() #order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount results = new DQ.D...
# consume all orders we can at this price level, starting with the oldest cur_order = order_level.orders.shift() while cur_order?.offered_amount <= amount_remaining amount_filled += cur_order.amount amount_remaining -= cur_order.amount order_level.size -= cur_order.amount ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
9a339e9b5145ff37fd81139aed77ff810a94f13c
663
https://github.com/buttercoin/buttercoin/blob/9a339e9b5145ff37fd81139aed77ff810a94f13c/lib/datastore/book.coffee
69
118
buttercoin/buttercoin:lib/datastore/book.coffee:6:raw_corpus
raw_corpus
results.push mkPartialOrder(cur_order, filled, remaining) return false # don't want more price levels closed.forEach (x) => joinQueues(results, x.order_level.orders, mkCloseOrder) @store.delete(x.price) if amount_remaining == 0 results.push mkCloseOrder(orig_order) else if amount...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
9a339e9b5145ff37fd81139aed77ff810a94f13c
663
https://github.com/buttercoin/buttercoin/blob/9a339e9b5145ff37fd81139aed77ff810a94f13c/lib/datastore/book.coffee
119
147
buttercoin/buttercoin:lib/datastore/book.coffee:6:completion
completion
results.push mkPartialOrder(cur_order, filled, remaining) return false # don't want more price levels closed.forEach (x) => joinQueues(results, x.order_level.orders, mkCloseOrder) @store.delete(x.price) if amount_remaining == 0 results.push mkCloseOrder(orig_order) else if amount...
} else [filled, remaining] = orig_order.split(amount_filled) results.push mkPartialOrder(orig_order, filled, remaining) return results add_order: (order) => @store.add_to_price_level(order.price, order) return { status: 'success' kind: 'order_opened' order: order }
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
9a339e9b5145ff37fd81139aed77ff810a94f13c
663
https://github.com/buttercoin/buttercoin/blob/9a339e9b5145ff37fd81139aed77ff810a94f13c/lib/datastore/book.coffee
119
147
buttercoin/buttercoin:lib/datastore/book.coffee:3:raw_corpus
raw_corpus
mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled residual_order: remaining original_order: original_order }
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
16
22
buttercoin/buttercoin:lib/datastore/book.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled residual_order: remaining original_order: original_order } ```
var mkPartialOrder; mkPartialOrder = function(original_order, filled, remaining) { return { status: 'success', kind: 'order_partially_filled', filled_order: filled, residual_order: remaining, original_order: original_order }; };
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
16
22
buttercoin/buttercoin:lib/datastore/book.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var mkPartialOrder; mkPartialOrder = function(original_order, filled, remaining) { return { status: 'success', kind: 'order_partially_filled', filled_order: filled, residual_order: remaining, original_order: original_order }; }; ```
mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled residual_order: remaining original_order: original_order }
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
16
22
buttercoin/buttercoin:lib/datastore/book.coffee:4:raw_corpus
raw_corpus
class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @insert(price, level) level.orders.push(order) level....
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
24
62
buttercoin/buttercoin:lib/datastore/book.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @inse...
var BookStore; BookStore = class BookStore { constructor() { this.add_to_price_level = this.add_to_price_level.bind(this); // TODO - optimize this to allow for halting this.for_levels_above = this.for_levels_above.bind(this); this.insert = this.insert.bind(this); this.delete = this.delete.bind(th...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
24
62
buttercoin/buttercoin:lib/datastore/book.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var BookStore; BookStore = class BookStore { constructor() { this.add_to_price_level = this.add_to_price_level.bind(this); // TODO - optimize this to allow for halting this.for_levels_above = this.for_levels_above.bind(this); this.insert = this.i...
class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @insert(price, level) level.orders.push(order) level....
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
24
62
buttercoin/buttercoin:lib/datastore/book.coffee:4:completion
completion
class BookStore constructor: -> @tree = redblack.tree() @size = 0 add_to_price_level: (price, order) => level = @tree.get(price) unless level dq = new DQ.Dequeue() level = { size: 0 orders: dq } @insert(price, level) level.orders.push(order) level....
# TODO - optimize this to allow for halting for_levels_above: (price, cb) => cursor = @tree.range(0, price) running = true cursor.forEach (order_level, cur_price) => running = cb(cur_price, order_level) if running insert: (price, level) => @tree.insert(price, level) @size += 1 delete: ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
24
62
buttercoin/buttercoin:lib/datastore/book.coffee:5:raw_corpus
raw_corpus
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount results = new DQ.De...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
65
114
buttercoin/buttercoin:lib/datastore/book.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_...
var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, closed, orig_order, results; orig_order = order; order = order.clone(); ...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
65
114
buttercoin/buttercoin:lib/datastore/book.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.store = new BookStore(); } fill_orders_with(order) { var amount_filled, amount_remaining, closed, orig_order, results; ...
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount results = new DQ.De...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
65
114
buttercoin/buttercoin:lib/datastore/book.coffee:5:completion
completion
module.exports = class Book constructor: -> @store = new BookStore() fill_orders_with: (order) => orig_order = order order = order.clone() order.price = 1/order.price #cur = @store.head() closed = [] amount_filled = 0 amount_remaining = order.received_amount results = new DQ.De...
# consume all orders we can at this price level, starting with the oldest cur_order = order_level.orders.shift() while cur_order?.offered_amount <= amount_remaining amount_filled += cur_order.amount amount_remaining -= cur_order.amount order_level.size -= cur_order.amount ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
7d44e1767c19e62d821fd3b69e6a772fa3fb68c3
663
https://github.com/buttercoin/buttercoin/blob/7d44e1767c19e62d821fd3b69e6a772fa3fb68c3/lib/datastore/book.coffee
65
114
buttercoin/buttercoin:lib/datastore/book.coffee:3:raw_corpus
raw_corpus
mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled remaining_order: remaining original_order: original_order }
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
15
21
buttercoin/buttercoin:lib/datastore/book.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled remaining_order: remaining original_order: original_order } ```
var mkPartialOrder; mkPartialOrder = function(original_order, filled, remaining) { return { status: 'success', kind: 'order_partially_filled', filled_order: filled, remaining_order: remaining, original_order: original_order }; };
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
15
21
buttercoin/buttercoin:lib/datastore/book.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var mkPartialOrder; mkPartialOrder = function(original_order, filled, remaining) { return { status: 'success', kind: 'order_partially_filled', filled_order: filled, remaining_order: remaining, original_order: original_order }; }; ```
mkPartialOrder = (original_order, filled, remaining) -> { status: 'success' kind: 'order_partially_filled' filled_order: filled remaining_order: remaining original_order: original_order }
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
15
21
buttercoin/buttercoin:lib/datastore/book.coffee:4:raw_corpus
raw_corpus
module.exports = class Book constructor: -> #(@inverted=false) -> #(@offered_currency, @received_currency) -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => # TODO - Move this check to the market? orig_order = ...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
23
72
buttercoin/buttercoin:lib/datastore/book.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Book constructor: -> #(@inverted=false) -> #(@offered_currency, @received_currency) -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => ...
var Book; module.exports = Book = class Book { constructor() { //(@inverted=false) -> #(@offered_currency, @received_currency) -> this.fill_orders_with = this.fill_orders_with.bind(this); // TODO - keep a typed array of price levels combined with a hash of actual orders? this.store = new SkipList(); } ...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
23
72
buttercoin/buttercoin:lib/datastore/book.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Book; module.exports = Book = class Book { constructor() { //(@inverted=false) -> #(@offered_currency, @received_currency) -> this.fill_orders_with = this.fill_orders_with.bind(this); // TODO - keep a typed array of price levels combined with a hash ...
module.exports = class Book constructor: -> #(@inverted=false) -> #(@offered_currency, @received_currency) -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => # TODO - Move this check to the market? orig_order = ...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
23
72
buttercoin/buttercoin:lib/datastore/book.coffee:4:completion
completion
module.exports = class Book constructor: -> #(@inverted=false) -> #(@offered_currency, @received_currency) -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => # TODO - Move this check to the market? orig_order = ...
# queue the entire price level to be closed closed.push(cur) else # consume all orders we can at this price level, starting with the oldest cur_order = order_level.orders.shift() while cur_order?.offered_amount <= amount_remaining amount_filled += cur_order.amount ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
23
72
buttercoin/buttercoin:lib/datastore/book.coffee:5:raw_corpus
raw_corpus
order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialOrder(cur_order, filled, remaining) cur = cur.r closed.forEach (x) => joinQueues(results, x.payload.orders, mkCloseOrder) @store.delete_node(x) unless @store.is_sentinel(x) i...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
73
118
buttercoin/buttercoin:lib/datastore/book.coffee:5:completion
completion
order_level.orders.unshift(remaining) # report the partially filled order results.push mkPartialOrder(cur_order, filled, remaining) cur = cur.r closed.forEach (x) => joinQueues(results, x.payload.orders, mkCloseOrder) @store.delete_node(x) unless @store.is_sentinel(x) i...
return results add_order: (order) => # get the node at or below a price level node = @store.lower_bound(order.price) if node?.v == order.price # append to current order level node.payload.size += order.offered_amount node.payload.orders.push(order) else # create order level ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7
663
https://github.com/buttercoin/buttercoin/blob/52561a472f9db748bb5ad7eeaceaf6ea2e1e26c7/lib/datastore/book.coffee
73
118
buttercoin/buttercoin:lib/datastore/book.coffee:3:raw_corpus
raw_corpus
module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => cur = @store.head() closed = [] # TODO - snip skiplist at a certain point, requires changes in SkipList amount_f...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
beb154c59115d3cef9eb69901c4b6630725cde44
663
https://github.com/buttercoin/buttercoin/blob/beb154c59115d3cef9eb69901c4b6630725cde44/lib/datastore/book.coffee
15
64
buttercoin/buttercoin:lib/datastore/book.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => cur = @store.head() closed = [] # TODO - snip skiplist at a...
var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); // TODO - keep a typed array of price levels combined with a hash of actual orders? this.store = new SkipList(); } fill_orders_with(order) { var amount_filled, amount_remainin...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
beb154c59115d3cef9eb69901c4b6630725cde44
663
https://github.com/buttercoin/buttercoin/blob/beb154c59115d3cef9eb69901c4b6630725cde44/lib/datastore/book.coffee
15
64
buttercoin/buttercoin:lib/datastore/book.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Book; module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); // TODO - keep a typed array of price levels combined with a hash of actual orders? this.store = new SkipList(); } fill_orde...
module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => cur = @store.head() closed = [] # TODO - snip skiplist at a certain point, requires changes in SkipList amount_f...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
beb154c59115d3cef9eb69901c4b6630725cde44
663
https://github.com/buttercoin/buttercoin/blob/beb154c59115d3cef9eb69901c4b6630725cde44/lib/datastore/book.coffee
15
64
buttercoin/buttercoin:lib/datastore/book.coffee:3:completion
completion
module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => cur = @store.head() closed = [] # TODO - snip skiplist at a certain point, requires changes in SkipList amount_f...
while cur_order?.offered_amount <= amount_remaining amount_filled += cur_order.amount amount_remaining -= cur_order.amount order_level.size -= cur_order.amount # there must always be another order here or else we would have consumed # the entire price level at once ...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
beb154c59115d3cef9eb69901c4b6630725cde44
663
https://github.com/buttercoin/buttercoin/blob/beb154c59115d3cef9eb69901c4b6630725cde44/lib/datastore/book.coffee
15
64
buttercoin/buttercoin:lib/datastore/book.coffee:4:raw_corpus
raw_corpus
joinQueues(results, x.payload.orders, mkCloseOrder) @store.delete_node(x) unless @store.is_sentinel(x) if amount_remaining == 0 results.push mkCloseOrder(order) else if amount_filled == 0 results.push { status: 'success' } else results.push { status: 'success'...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
beb154c59115d3cef9eb69901c4b6630725cde44
663
https://github.com/buttercoin/buttercoin/blob/beb154c59115d3cef9eb69901c4b6630725cde44/lib/datastore/book.coffee
65
102
buttercoin/buttercoin:lib/datastore/book.coffee:4:completion
completion
joinQueues(results, x.payload.orders, mkCloseOrder) @store.delete_node(x) unless @store.is_sentinel(x) if amount_remaining == 0 results.push mkCloseOrder(order) else if amount_filled == 0 results.push { status: 'success' } else results.push { status: 'success'...
node = @store.lower_bound(order.price) if node?.v == order.price # append to current order level node.payload.size += order.offered_amount node.payload.orders.push(order) else # create order level dq = new DQ.Dequeue() dq.push(order) level = size: order.offered_...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
beb154c59115d3cef9eb69901c4b6630725cde44
663
https://github.com/buttercoin/buttercoin/blob/beb154c59115d3cef9eb69901c4b6630725cde44/lib/datastore/book.coffee
65
102
buttercoin/buttercoin:lib/datastore/book.coffee:1:raw_corpus
raw_corpus
SkipList = require('../../experimental/skiplist').SkipList DQ = require ('deque') module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => cur = @store.head() closed = [] #...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
6b8057bca2866e8ea9401136c336ef25f188c47c
663
https://github.com/buttercoin/buttercoin/blob/6b8057bca2866e8ea9401136c336ef25f188c47c/lib/datastore/book.coffee
1
50
buttercoin/buttercoin:lib/datastore/book.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript SkipList = require('../../experimental/skiplist').SkipList DQ = require ('deque') module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_w...
var Book, DQ, SkipList; SkipList = require('../../experimental/skiplist').SkipList; DQ = require('deque'); module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.add_order = this.add_order.bind(this); // TODO - keep a typed array of price lev...
CoffeeScript
JavaScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
6b8057bca2866e8ea9401136c336ef25f188c47c
663
https://github.com/buttercoin/buttercoin/blob/6b8057bca2866e8ea9401136c336ef25f188c47c/lib/datastore/book.coffee
1
50
buttercoin/buttercoin:lib/datastore/book.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Book, DQ, SkipList; SkipList = require('../../experimental/skiplist').SkipList; DQ = require('deque'); module.exports = Book = class Book { constructor() { this.fill_orders_with = this.fill_orders_with.bind(this); this.add_order = this.add_order.bi...
SkipList = require('../../experimental/skiplist').SkipList DQ = require ('deque') module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => cur = @store.head() closed = [] #...
JavaScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
6b8057bca2866e8ea9401136c336ef25f188c47c
663
https://github.com/buttercoin/buttercoin/blob/6b8057bca2866e8ea9401136c336ef25f188c47c/lib/datastore/book.coffee
1
50
buttercoin/buttercoin:lib/datastore/book.coffee:1:completion
completion
SkipList = require('../../experimental/skiplist').SkipList DQ = require ('deque') module.exports = class Book constructor: () -> # TODO - keep a typed array of price levels combined with a hash of actual orders? @store = new SkipList() fill_orders_with: (order) => cur = @store.head() closed = [] #...
while cur_order?.offered_amount <= amount_remaining amount_filled += cur_order.amount amount_remaining -= cur_order.amount order_level.size -= cur_order.amount if order_level.orders.isEmpty() cur_order = null else cur_order = order_level.orders.s...
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
6b8057bca2866e8ea9401136c336ef25f188c47c
663
https://github.com/buttercoin/buttercoin/blob/6b8057bca2866e8ea9401136c336ef25f188c47c/lib/datastore/book.coffee
1
50
buttercoin/buttercoin:lib/datastore/book.coffee:2:raw_corpus
raw_corpus
node = @store.lower_bound(order.price) if node?.v == order.price # append to current order level node.payload.size += order.offered_amount node.payload.orders.push(order) else # create order level dq = new DQ.Dequeue() dq.push(order) level = size: order.offered_...
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
6b8057bca2866e8ea9401136c336ef25f188c47c
663
https://github.com/buttercoin/buttercoin/blob/6b8057bca2866e8ea9401136c336ef25f188c47c/lib/datastore/book.coffee
51
63
buttercoin/buttercoin:lib/datastore/book.coffee:2:completion
completion
node = @store.lower_bound(order.price) if node?.v == order.price # append to current order level node.payload.size += order.offered_amount node.payload.orders.push(order) else
# create order level dq = new DQ.Dequeue() dq.push(order) level = size: order.offered_amount orders: dq @store.insert_before(node || @store.rs, order.price, level)
CoffeeScript
CoffeeScript
buttercoin/buttercoin
lib/datastore/book.coffee
MIT
6b8057bca2866e8ea9401136c336ef25f188c47c
663
https://github.com/buttercoin/buttercoin/blob/6b8057bca2866e8ea9401136c336ef25f188c47c/lib/datastore/book.coffee
51
63
cdglabs/apparatus:src/Evaluator/evaluateHtmlToImageURL.coffee:1:raw_corpus
raw_corpus
HtmlToSvg = require "../Util/HtmlToSvg" module.exports = htmlToImageURL = (html, width, height) -> svg = HtmlToSvg.convertHtmlToSvgSimple( """<body xmlns="http://www.w3.org/1999/xhtml">#{html}</body>""", width, height ) url = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg); return url
CoffeeScript
cdglabs/apparatus
src/Evaluator/evaluateHtmlToImageURL.coffee
MIT
107e0c2db5a0adf0f1c3b49f16f7625cff4e523b
1,052
https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Evaluator/evaluateHtmlToImageURL.coffee
1
10
cdglabs/apparatus:src/Evaluator/evaluateHtmlToImageURL.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript HtmlToSvg = require "../Util/HtmlToSvg" module.exports = htmlToImageURL = (html, width, height) -> svg = HtmlToSvg.convertHtmlToSvgSimple( """<body xmlns="http://www.w3.org/1999/xhtml">#{html}</body>""", width, height ) url = "data:image/svg+xml;c...
var HtmlToSvg, htmlToImageURL; HtmlToSvg = require("../Util/HtmlToSvg"); module.exports = htmlToImageURL = function(html, width, height) { var svg, url; svg = HtmlToSvg.convertHtmlToSvgSimple(`<body xmlns="http://www.w3.org/1999/xhtml">${html}</body>`, width, height); url = "data:image/svg+xml;charset=utf-8," +...
CoffeeScript
JavaScript
cdglabs/apparatus
src/Evaluator/evaluateHtmlToImageURL.coffee
MIT
107e0c2db5a0adf0f1c3b49f16f7625cff4e523b
1,052
https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Evaluator/evaluateHtmlToImageURL.coffee
1
10
cdglabs/apparatus:src/Evaluator/evaluateHtmlToImageURL.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var HtmlToSvg, htmlToImageURL; HtmlToSvg = require("../Util/HtmlToSvg"); module.exports = htmlToImageURL = function(html, width, height) { var svg, url; svg = HtmlToSvg.convertHtmlToSvgSimple(`<body xmlns="http://www.w3.org/1999/xhtml">${html}</body>`, width,...
HtmlToSvg = require "../Util/HtmlToSvg" module.exports = htmlToImageURL = (html, width, height) -> svg = HtmlToSvg.convertHtmlToSvgSimple( """<body xmlns="http://www.w3.org/1999/xhtml">#{html}</body>""", width, height ) url = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg); return url
JavaScript
CoffeeScript
cdglabs/apparatus
src/Evaluator/evaluateHtmlToImageURL.coffee
MIT
107e0c2db5a0adf0f1c3b49f16f7625cff4e523b
1,052
https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Evaluator/evaluateHtmlToImageURL.coffee
1
10
cdglabs/apparatus:src/Evaluator/evaluateHtmlToImageURL.coffee:1:completion
completion
HtmlToSvg = require "../Util/HtmlToSvg" module.exports = htmlToImageURL = (html, width, height) -> svg = HtmlToSvg.convertHtmlToSvgSimple(
"""<body xmlns="http://www.w3.org/1999/xhtml">#{html}</body>""", width, height ) url = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg); return url
CoffeeScript
CoffeeScript
cdglabs/apparatus
src/Evaluator/evaluateHtmlToImageURL.coffee
MIT
107e0c2db5a0adf0f1c3b49f16f7625cff4e523b
1,052
https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Evaluator/evaluateHtmlToImageURL.coffee
1
10
Pathgather/please-wait:src/loading_page.coffee:1:raw_corpus
raw_corpus
window.pgloading = { done: -> return if @_done || !@_loadingDiv? @_done = true if @_options.fadeOut transitionEvent = @_whichTransitionEvent() if transitionEvent? @_loadingDiv.className += " pg-loaded" @_loadingDiv.addEventListener transitionEvent, () => @_loadingDo...
CoffeeScript
Pathgather/please-wait
src/loading_page.coffee
MIT
3c862e7786e79fc58c27db5ffb3e92e1f9fc4f02
1,583
https://github.com/Pathgather/please-wait/blob/3c862e7786e79fc58c27db5ffb3e92e1f9fc4f02/src/loading_page.coffee
1
50