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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CaryLandholt/AngularFun:src/scripts/controllers/twitterController.coffee:1:raw_corpus | raw_corpus | ###global define###
define ['controllers/controllers', 'services/twitterService'], (controllers) ->
'use strict'
controllers.controller 'twitterController', ['$log', '$scope', '$rootScope', '$location', 'twitterService', ($log, $scope, $rootScope, $location, twitterService) ->
$scope.search = (searchTerm) ->
$... | CoffeeScript | CaryLandholt/AngularFun | src/scripts/controllers/twitterController.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/controllers/twitterController.coffee | 1 | 16 | ||
CaryLandholt/AngularFun:src/scripts/controllers/twitterController.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###
define ['controllers/controllers', 'services/twitterService'], (controllers) ->
'use strict'
controllers.controller 'twitterController', ['$log', '$scope', '$rootScope', '$location', 'twitterService', ($log, $scope, $rootScope, $location, ... | /*global define*/
define(['controllers/controllers', 'services/twitterService'], function(controllers) {
'use strict';
return controllers.controller('twitterController', [
'$log',
'$scope',
'$rootScope',
'$location',
'twitterService',
function($log,
$scope,
$rootScope,
$location,... | CoffeeScript | JavaScript | CaryLandholt/AngularFun | src/scripts/controllers/twitterController.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/controllers/twitterController.coffee | 1 | 16 |
CaryLandholt/AngularFun:src/scripts/controllers/twitterController.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*global define*/
define(['controllers/controllers', 'services/twitterService'], function(controllers) {
'use strict';
return controllers.controller('twitterController', [
'$log',
'$scope',
'$rootScope',
'$location',
'twitterService',
fu... | ###global define###
define ['controllers/controllers', 'services/twitterService'], (controllers) ->
'use strict'
controllers.controller 'twitterController', ['$log', '$scope', '$rootScope', '$location', 'twitterService', ($log, $scope, $rootScope, $location, twitterService) ->
$scope.search = (searchTerm) ->
$... | JavaScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/controllers/twitterController.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/controllers/twitterController.coffee | 1 | 16 |
CaryLandholt/AngularFun:src/scripts/controllers/twitterController.coffee:1:completion | completion | ###global define###
define ['controllers/controllers', 'services/twitterService'], (controllers) ->
'use strict'
controllers.controller 'twitterController', ['$log', '$scope', '$rootScope', '$location', 'twitterService', ($log, $scope, $rootScope, $location, twitterService) ->
$scope.search = (searchTerm) ->
$... | $scope.onRouteChange = (routeParams) ->
$scope.searchTerm = routeParams.searchTerm
twitterService.get $scope.searchTerm
, (tweets) ->
$scope.tweets = tweets
] | CoffeeScript | CoffeeScript | CaryLandholt/AngularFun | src/scripts/controllers/twitterController.coffee | MIT | 6d23f0be02cb2e938565aca7cb881fd70beefb35 | 672 | https://github.com/CaryLandholt/AngularFun/blob/6d23f0be02cb2e938565aca7cb881fd70beefb35/src/scripts/controllers/twitterController.coffee | 1 | 16 |
gss/engine:src/types/URL.coffee:1:raw_corpus | raw_corpus | Command = require('../Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]]
return obj
@define
'url': ->
'src': ->
'canvas': ->
module.exports = URL | CoffeeScript | gss/engine | src/types/URL.coffee | MIT | e0d31eda3ebf8554204221731fbcfaa35d711a39 | 2,854 | https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/types/URL.coffee | 1 | 18 | ||
gss/engine:src/types/URL.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Command = require('../Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]]
return obj
@define
'url': ->
'src': ->
'canvas': ->
module.exports = URL
... | var Command, URL;
Command = require('../Command');
URL = (function() {
class URL extends Command {
constructor(obj) {
switch (typeof obj) {
case 'object':
if (URL[obj[0]]) {
return obj;
}
}
}
};
URL.prototype.type = 'URL';
URL.define({
'url': ... | CoffeeScript | JavaScript | gss/engine | src/types/URL.coffee | MIT | e0d31eda3ebf8554204221731fbcfaa35d711a39 | 2,854 | https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/types/URL.coffee | 1 | 18 |
gss/engine:src/types/URL.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Command, URL;
Command = require('../Command');
URL = (function() {
class URL extends Command {
constructor(obj) {
switch (typeof obj) {
case 'object':
if (URL[obj[0]]) {
return obj;
}
}
}
};
... | Command = require('../Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]]
return obj
@define
'url': ->
'src': ->
'canvas': ->
module.exports = URL | JavaScript | CoffeeScript | gss/engine | src/types/URL.coffee | MIT | e0d31eda3ebf8554204221731fbcfaa35d711a39 | 2,854 | https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/types/URL.coffee | 1 | 18 |
gss/engine:src/types/URL.coffee:1:completion | completion | Command = require('../Command')
class URL extends Command
type: 'URL'
constructor: (obj) ->
switch typeof obj
when 'object'
if URL[obj[0]] | return obj
@define
'url': ->
'src': ->
'canvas': ->
module.exports = URL | CoffeeScript | CoffeeScript | gss/engine | src/types/URL.coffee | MIT | e0d31eda3ebf8554204221731fbcfaa35d711a39 | 2,854 | https://github.com/gss/engine/blob/e0d31eda3ebf8554204221731fbcfaa35d711a39/src/types/URL.coffee | 1 | 18 |
gss/engine:src/types/URL.coffee:1:raw_corpus | raw_corpus | Command = require('../Command')
class URL extends Command
type: 'URL'
@define
'url': ->
'src': -> | CoffeeScript | gss/engine | src/types/URL.coffee | MIT | d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0 | 2,854 | https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/types/URL.coffee | 1 | 7 | ||
gss/engine:src/types/URL.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Command = require('../Command')
class URL extends Command
type: 'URL'
@define
'url': ->
'src': ->
``` | var Command, URL;
Command = require('../Command');
URL = (function() {
class URL extends Command {};
URL.prototype.type = 'URL';
URL.define({
'url': function() {},
'src': function() {}
});
return URL;
}).call(this); | CoffeeScript | JavaScript | gss/engine | src/types/URL.coffee | MIT | d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0 | 2,854 | https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/types/URL.coffee | 1 | 7 |
gss/engine:src/types/URL.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Command, URL;
Command = require('../Command');
URL = (function() {
class URL extends Command {};
URL.prototype.type = 'URL';
URL.define({
'url': function() {},
'src': function() {}
});
return URL;
}).call(this);
``` | Command = require('../Command')
class URL extends Command
type: 'URL'
@define
'url': ->
'src': -> | JavaScript | CoffeeScript | gss/engine | src/types/URL.coffee | MIT | d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0 | 2,854 | https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/types/URL.coffee | 1 | 7 |
gss/engine:src/types/URL.coffee:1:completion | completion | Command = require('../Command')
class URL extends Command | type: 'URL'
@define
'url': ->
'src': -> | CoffeeScript | CoffeeScript | gss/engine | src/types/URL.coffee | MIT | d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0 | 2,854 | https://github.com/gss/engine/blob/d3a6c74b85e6d12a9ec02c24fef87d4c22bd9cb0/src/types/URL.coffee | 1 | 7 |
xhan/qqbot:src/hubot-qq.coffee:1:raw_corpus | raw_corpus | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/hubot-qq.coffee | 1 | 50 | ||
xhan/qqbot:src/hubot-qq.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope,... | var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth, defaults;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../src/qqbot");
defaults = require("../src/defaul... | CoffeeScript | JavaScript | xhan/qqbot | src/hubot-qq.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth, defaults;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = requ... | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | JavaScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:1:completion | completion | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | groupname: process.env.HUBOT_QQ_GROUP or 'qqbot群'
port: process.env.HUBOT_QQ_IMGPORT or 3000
host: process.env.HUBOT_QQ_IMGHOST or 'localhost'
plugins: ['help']
skip_login = process.env.HUBOT_QQ_SKIP_LOGIN is 'true'
unless options.account? and options.password? and options.groupn... | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:2:raw_corpus | raw_corpus | # uin changed every-time
user = @robot.brain.userForId message.from_uin , name:message.from_user.nick , room:options.groupname
@receive new TextMessage user, content, message.uid
# @callback (cookies,auth_info)
login_qq: (skip_login, options,callback)->
defaults.set_path '/tmp/store.... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/hubot-qq.coffee | 51 | 76 | ||
xhan/qqbot:src/hubot-qq.coffee:2:completion | completion | # uin changed every-time
user = @robot.brain.userForId message.from_uin , name:message.from_user.nick , room:options.groupname
@receive new TextMessage user, content, message.uid
# @callback (cookies,auth_info)
login_qq: (skip_login, options,callback)->
defaults.set_path '/tmp/store.... | callback(cookies , auth_info )
else
auth.login options , (cookies,auth_info)=>
if process.env.HUBOT_QQ_DEBUG?
defaults.data 'qq-cookies', cookies
defaults.data 'qq-auth' , auth_info
defaults.save()
callback(cookies,auth_info)
exports.use = (robot) ->
new QQ... | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0 | 1,435 | https://github.com/xhan/qqbot/blob/f3b62a4a6e423cd85a7a2e06da5e5e51da940fe0/src/hubot-qq.coffee | 51 | 76 |
xhan/qqbot:src/hubot-qq.coffee:1:raw_corpus | raw_corpus | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e917c473c828b8ca49f922d703b2606f95a8ce06 | 1,435 | https://github.com/xhan/qqbot/blob/e917c473c828b8ca49f922d703b2606f95a8ce06/src/hubot-qq.coffee | 1 | 50 | ||
xhan/qqbot:src/hubot-qq.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope,... | var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth, defaults;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../src/qqbot");
defaults = require("../src/defaul... | CoffeeScript | JavaScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e917c473c828b8ca49f922d703b2606f95a8ce06 | 1,435 | https://github.com/xhan/qqbot/blob/e917c473c828b8ca49f922d703b2606f95a8ce06/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth, defaults;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = requ... | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | JavaScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e917c473c828b8ca49f922d703b2606f95a8ce06 | 1,435 | https://github.com/xhan/qqbot/blob/e917c473c828b8ca49f922d703b2606f95a8ce06/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:1:completion | completion | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | groupname: process.env.HUBOT_QQ_GROUP or 'qqbot群'
port: process.env.HUBOT_QQ_IMGPORT or 3000
host: process.env.HUBOT_QQ_IMGHOST or 'localhost'
plugins: ['help']
skip_login = process.env.HUBOT_QQ_SKIP_LOGIN is 'true'
unless options.account? and options.password? and options.groupn... | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e917c473c828b8ca49f922d703b2606f95a8ce06 | 1,435 | https://github.com/xhan/qqbot/blob/e917c473c828b8ca49f922d703b2606f95a8ce06/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:1:raw_corpus | raw_corpus | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 1 | 50 | ||
xhan/qqbot:src/hubot-qq.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope,... | var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth, defaults;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../src/qqbot");
defaults = require("../src/defaul... | CoffeeScript | JavaScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth, defaults;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = requ... | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | JavaScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:1:completion | completion | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
defaults = require "../src/defaults"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@robot.logger.info "hubot is sending ... | groupname: process.env.HUBOT_QQ_GROUP or 'qqbot群'
port: process.env.HUBOT_QQ_IMGPORT or 3000
host: process.env.HUBOT_QQ_IMGHOST or 'localhost'
plugins: ['help']
skip_login = process.env.HUBOT_QQ_SKIP_LOGIN is 'true'
unless options.account? and options.password? and options.groupn... | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 1 | 50 |
xhan/qqbot:src/hubot-qq.coffee:2:raw_corpus | raw_corpus | @receive new TextMessage user, content, message.uid
# @callback (cookies,auth_info)
login_qq: (skip_login, options,callback)->
defaults.set_path '/tmp/store.json'
if skip_login
cookies = defaults.data 'qq-cookies'
auth_info = defaults.data 'qq-auth'
@robot.logger.info "skip login",auth... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 51 | 74 | ||
xhan/qqbot:src/hubot-qq.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@receive new TextMessage user, content, message.uid
# @callback (cookies,auth_info)
login_qq: (skip_login, options,callback)->
defaults.set_path '/tmp/store.json'
if skip_login
cookies = defaults.data 'qq-cookies'
auth_info = defaults.... | this.receive(new TextMessage(user, content, message.uid({
// @callback (cookies,auth_info)
login_qq: function(skip_login, options, callback) {
var auth_info, cookies;
defaults.set_path('/tmp/store.json');
if (skip_login) {
cookies = defaults.data('qq-cookies');
auth_info = defaults.data('qq... | CoffeeScript | JavaScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 51 | 74 |
xhan/qqbot:src/hubot-qq.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.receive(new TextMessage(user, content, message.uid({
// @callback (cookies,auth_info)
login_qq: function(skip_login, options, callback) {
var auth_info, cookies;
defaults.set_path('/tmp/store.json');
if (skip_login) {
cookies = defaults.... | @receive new TextMessage user, content, message.uid
# @callback (cookies,auth_info)
login_qq: (skip_login, options,callback)->
defaults.set_path '/tmp/store.json'
if skip_login
cookies = defaults.data 'qq-cookies'
auth_info = defaults.data 'qq-auth'
@robot.logger.info "skip login",auth... | JavaScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 51 | 74 |
xhan/qqbot:src/hubot-qq.coffee:2:completion | completion | @receive new TextMessage user, content, message.uid
# @callback (cookies,auth_info)
login_qq: (skip_login, options,callback)->
defaults.set_path '/tmp/store.json'
if skip_login
cookies = defaults.data 'qq-cookies'
auth_info = defaults.data 'qq-auth'
@robot.logger.info "skip login",auth... | else
auth.login options , (cookies,auth_info)=>
if process.env.HUBOT_QQ_DEBUG?
defaults.data 'qq-cookies', cookies
defaults.data 'qq-auth' , auth_info
defaults.save()
callback(cookies,auth_info)
exports.use = (robot) ->
new QQHubotAdapter robot | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | da192da751ed39002baa93d1b74af91a311573cc | 1,435 | https://github.com/xhan/qqbot/blob/da192da751ed39002baa93d1b74af91a311573cc/src/hubot-qq.coffee | 51 | 74 |
xhan/qqbot:src/hubot-qq.coffee:1:raw_corpus | raw_corpus | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@se... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e1641da8633e2c5d149f84bba7caebbf5dc639f3 | 1,435 | https://github.com/xhan/qqbot/blob/e1641da8633e2c5d149f84bba7caebbf5dc639f3/src/hubot-qq.coffee | 1 | 49 | ||
xhan/qqbot:src/hubot-qq.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str f... | var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../src/qqbot");
QQHubotAdapter = class QQHubotAdapter exten... | CoffeeScript | JavaScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e1641da8633e2c5d149f84bba7caebbf5dc639f3 | 1,435 | https://github.com/xhan/qqbot/blob/e1641da8633e2c5d149f84bba7caebbf5dc639f3/src/hubot-qq.coffee | 1 | 49 |
xhan/qqbot:src/hubot-qq.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../sr... | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@se... | JavaScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e1641da8633e2c5d149f84bba7caebbf5dc639f3 | 1,435 | https://github.com/xhan/qqbot/blob/e1641da8633e2c5d149f84bba7caebbf5dc639f3/src/hubot-qq.coffee | 1 | 49 |
xhan/qqbot:src/hubot-qq.coffee:1:completion | completion | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@se... | unless options.account? and options.password? and options.groupname?
@robot.logger.error "请配置qq 密码 和监听群名字,具体查阅帮助"
process.exit(1)
# TODO: login failed callback
auth.login options , (cookies,auth_info)=>
@bot = new QQBot(cookies,auth_info,options)
@bot.listen_group options.groupname , (... | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | e1641da8633e2c5d149f84bba7caebbf5dc639f3 | 1,435 | https://github.com/xhan/qqbot/blob/e1641da8633e2c5d149f84bba7caebbf5dc639f3/src/hubot-qq.coffee | 1 | 49 |
xhan/qqbot:src/hubot-qq.coffee:1:raw_corpus | raw_corpus | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@se... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 7f3efc0a273c4884826c150c08457399ce225766 | 1,435 | https://github.com/xhan/qqbot/blob/7f3efc0a273c4884826c150c08457399ce225766/src/hubot-qq.coffee | 1 | 49 | ||
xhan/qqbot:src/hubot-qq.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str f... | var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../src/qqbot");
QQHubotAdapter = class QQHubotAdapter exten... | CoffeeScript | JavaScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 7f3efc0a273c4884826c150c08457399ce225766 | 1,435 | https://github.com/xhan/qqbot/blob/7f3efc0a273c4884826c150c08457399ce225766/src/hubot-qq.coffee | 1 | 49 |
xhan/qqbot:src/hubot-qq.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../sr... | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@se... | JavaScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 7f3efc0a273c4884826c150c08457399ce225766 | 1,435 | https://github.com/xhan/qqbot/blob/7f3efc0a273c4884826c150c08457399ce225766/src/hubot-qq.coffee | 1 | 49 |
xhan/qqbot:src/hubot-qq.coffee:1:completion | completion | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@se... | unless options.account? and options.password? and options.groupname?
@robot.logger.error "请配置qq 密码 和监听群名字,具体查阅帮助"
process.exit(1)
# TODO: login failed callback
auth.login options , (cookies,auth_info)=>
@bot = new QQBot(cookies,auth_info,options)
@bot.listen_group options.groupname , (... | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 7f3efc0a273c4884826c150c08457399ce225766 | 1,435 | https://github.com/xhan/qqbot/blob/7f3efc0a273c4884826c150c08457399ce225766/src/hubot-qq.coffee | 1 | 49 |
xhan/qqbot:src/hubot-qq.coffee:1:raw_corpus | raw_corpus | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 8b146ed387f65ad6f5d7829dedccbd5eb2d05717 | 1,435 | https://github.com/xhan/qqbot/blob/8b146ed387f65ad6f5d7829dedccbd5eb2d05717/src/hubot-qq.coffee | 1 | 46 | ||
xhan/qqbot:src/hubot-qq.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str... | var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../src/qqbot");
QQHubotAdapter = class QQHubotAdapter exten... | CoffeeScript | JavaScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 8b146ed387f65ad6f5d7829dedccbd5eb2d05717 | 1,435 | https://github.com/xhan/qqbot/blob/8b146ed387f65ad6f5d7829dedccbd5eb2d05717/src/hubot-qq.coffee | 1 | 46 |
xhan/qqbot:src/hubot-qq.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Adapter, EnterMessage, LeaveMessage, QQBot, QQHubotAdapter, Robot, TextMessage, api, auth;
({Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot'));
auth = require("../src/qqauth");
api = require("../src/qqapi");
QQBot = require("../sr... | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@... | JavaScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 8b146ed387f65ad6f5d7829dedccbd5eb2d05717 | 1,435 | https://github.com/xhan/qqbot/blob/8b146ed387f65ad6f5d7829dedccbd5eb2d05717/src/hubot-qq.coffee | 1 | 46 |
xhan/qqbot:src/hubot-qq.coffee:1:completion | completion | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
@group.send str for str in strings
reply: (user, strings...) ->
@... | unless options.account? and options.password? and options.groupname?
@robot.logger.error \
"请配置qq 密码 和监听群名字,具体查阅帮助"
process.exit(1)
# login
# TODO: login failed callback
auth.login options , (cookies,auth_info)=>
@bot = new QQBot(cookies,auth_info,options)
@bot.listen_group ... | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 8b146ed387f65ad6f5d7829dedccbd5eb2d05717 | 1,435 | https://github.com/xhan/qqbot/blob/8b146ed387f65ad6f5d7829dedccbd5eb2d05717/src/hubot-qq.coffee | 1 | 46 |
xhan/qqbot:src/hubot-qq.coffee:1:raw_corpus | raw_corpus | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
for str in strings:
reply: (user, strings...) ->
@send user... | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 85831957dd86887e66c6bd7ffccc51eee89a726a | 1,435 | https://github.com/xhan/qqbot/blob/85831957dd86887e66c6bd7ffccc51eee89a726a/src/hubot-qq.coffee | 1 | 24 | ||
xhan/qqbot:src/hubot-qq.coffee:1:completion | completion | {Robot, Adapter, EnterMessage, LeaveMessage, TextMessage} = require('hubot')
auth = require "../src/qqauth"
api = require "../src/qqapi"
QQBot= require "../src/qqbot"
class QQHubotAdapter extends Adapter
send: (envelope, strings...) ->
for str in strings: | reply: (user, strings...) ->
@send user, strings...
run: ->
self = @
@emit "connected"
exports.use = (robot) ->
new SkypeAdapter robot | CoffeeScript | CoffeeScript | xhan/qqbot | src/hubot-qq.coffee | MIT | 85831957dd86887e66c6bd7ffccc51eee89a726a | 1,435 | https://github.com/xhan/qqbot/blob/85831957dd86887e66c6bd7ffccc51eee89a726a/src/hubot-qq.coffee | 1 | 24 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:raw_corpus | raw_corpus | module.exports = class TransactionLog
constructor: (@filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log()
e... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 6 | 55 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class TransactionLog
constructor: (@filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
... | var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(filename = 'transaction.log') {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.filename = filename;
}
start() {
... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(filename = 'transaction.log') {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(... | module.exports = class TransactionLog
constructor: (@filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log()
e... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:completion | completion | module.exports = class TransactionLog
constructor: (@filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log()
e... | replay_log: =>
# XXX: This code is basically guaranteed to have chunking problems right now.
# Fix and then test rigorously!!!
deferred = Q.defer()
Q.fcall =>
@readstream = fs.createReadStream(@filename, {flags: "r"})
console.log 'GOT READSTREAM'
parts = []
@readstream.on 'en... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:2:raw_corpus | raw_corpus | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 56 | 105 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:2:completion | completion | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | console.log 'Error reading transaction log: ', err
deferred.reject(err)
.done()
return deferred.promise
record: (message) =>
if not @writefd
console.log 'ERROR: transaction log not initialized. Did not record
message ', message
return
record = JSON.stringify(mes... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 56 | 105 |
buttercoin/buttercoin:lib/transactionlog.coffee:3:raw_corpus | raw_corpus | console.log 'FLUSHED'
shutdown: =>
fs.closeSync(@writefd)
@writefd = null | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 106 | 110 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:3:completion | completion | console.log 'FLUSHED' | shutdown: =>
fs.closeSync(@writefd)
@writefd = null | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | c2ee851c719f0fe1e0f59b6a33677ed938166549 | 663 | https://github.com/buttercoin/buttercoin/blob/c2ee851c719f0fe1e0f59b6a33677ed938166549/lib/transactionlog.coffee | 106 | 110 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:raw_corpus | raw_corpus | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
@writefd = null
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dan... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 9f825e246802b0eb9fb76a855bce0a7f780e167f | 663 | https://github.com/buttercoin/buttercoin/blob/9f825e246802b0eb9fb76a855bce0a7f780e167f/lib/transactionlog.coffee | 10 | 59 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
@writefd = null
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
... | var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor() {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.filename = 'transaction.log';
this.writefd = null;
}
start... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 9f825e246802b0eb9fb76a855bce0a7f780e167f | 663 | https://github.com/buttercoin/buttercoin/blob/9f825e246802b0eb9fb76a855bce0a7f780e167f/lib/transactionlog.coffee | 10 | 59 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor() {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.filename = '... | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
@writefd = null
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dan... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 9f825e246802b0eb9fb76a855bce0a7f780e167f | 663 | https://github.com/buttercoin/buttercoin/blob/9f825e246802b0eb9fb76a855bce0a7f780e167f/lib/transactionlog.coffee | 10 | 59 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:completion | completion | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
@writefd = null
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dan... | @writefd = writefd
replay_log: (execute_transaction) =>
# XXX: This code is basically guaranteed to have chunking problems right now.
# Fix and then test rigorously!!!
@readstream = fs.createReadStream(@filename, {flags: "r"})
console.log 'GOT READSTREAM'
deferred = Q.defer()
Q.fcall =>
... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 9f825e246802b0eb9fb76a855bce0a7f780e167f | 663 | https://github.com/buttercoin/buttercoin/blob/9f825e246802b0eb9fb76a855bce0a7f780e167f/lib/transactionlog.coffee | 10 | 59 |
buttercoin/buttercoin:lib/transactionlog.coffee:2:raw_corpus | raw_corpus | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 9f825e246802b0eb9fb76a855bce0a7f780e167f | 663 | https://github.com/buttercoin/buttercoin/blob/9f825e246802b0eb9fb76a855bce0a7f780e167f/lib/transactionlog.coffee | 60 | 106 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:2:completion | completion | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | .done()
return deferred.promise
record: (message) =>
console.log 'RECORDING', message
if @writefd == null
console.log 'NO WRITEFD AVAILABLE'
return Q.when(null)
l = message.length
part = jspack.Pack('I', [l])
buf = Buffer.concat [ Buffer(part), Buffer(message) ]
writeq = ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 9f825e246802b0eb9fb76a855bce0a7f780e167f | 663 | https://github.com/buttercoin/buttercoin/blob/9f825e246802b0eb9fb76a855bce0a7f780e167f/lib/transactionlog.coffee | 60 | 106 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:raw_corpus | raw_corpus | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 7417f7a7f37fc52dc4d234fda8a838804b5efeb6 | 663 | https://github.com/buttercoin/buttercoin/blob/7417f7a7f37fc52dc4d234fda8a838804b5efeb6/lib/transactionlog.coffee | 10 | 59 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_lo... | var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor() {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.filename = 'transaction.log';
}
start(execute_transaction) {
... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 7417f7a7f37fc52dc4d234fda8a838804b5efeb6 | 663 | https://github.com/buttercoin/buttercoin/blob/7417f7a7f37fc52dc4d234fda8a838804b5efeb6/lib/transactionlog.coffee | 10 | 59 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor() {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.filename = '... | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 7417f7a7f37fc52dc4d234fda8a838804b5efeb6 | 663 | https://github.com/buttercoin/buttercoin/blob/7417f7a7f37fc52dc4d234fda8a838804b5efeb6/lib/transactionlog.coffee | 10 | 59 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:completion | completion | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: (execute_transaction) =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@... | replay_log: (execute_transaction) =>
# XXX: This code is basically guaranteed to have chunking problems right now.
# Fix and then test rigorously!!!
@readstream = fs.createReadStream(@filename, {flags: "r"})
console.log 'GOT READSTREAM'
deferred = Q.defer()
Q.fcall =>
parts = []
... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 7417f7a7f37fc52dc4d234fda8a838804b5efeb6 | 663 | https://github.com/buttercoin/buttercoin/blob/7417f7a7f37fc52dc4d234fda8a838804b5efeb6/lib/transactionlog.coffee | 10 | 59 |
buttercoin/buttercoin:lib/transactionlog.coffee:2:raw_corpus | raw_corpus | if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.length == lenprefix
message = JSON.p... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 7417f7a7f37fc52dc4d234fda8a838804b5efeb6 | 663 | https://github.com/buttercoin/buttercoin/blob/7417f7a7f37fc52dc4d234fda8a838804b5efeb6/lib/transactionlog.coffee | 60 | 99 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:2:completion | completion | if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.length == lenprefix
message = JSON.p... | console.log 'ERROR'
.done()
return deferred.promise
record: (message) =>
console.log 'RECORDING', message
l = message.length
part = jspack.Pack('I', [l])
buf = Buffer.concat [ Buffer(part), Buffer(message) ]
writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)
console.l... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 7417f7a7f37fc52dc4d234fda8a838804b5efeb6 | 663 | https://github.com/buttercoin/buttercoin/blob/7417f7a7f37fc52dc4d234fda8a838804b5efeb6/lib/transactionlog.coffee | 60 | 99 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:raw_corpus | raw_corpus | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log()
... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 36b6dd4b6d6c21126771ff7e795767a400542fd1 | 663 | https://github.com/buttercoin/buttercoin/blob/36b6dd4b6d6c21126771ff7e795767a400542fd1/lib/transactionlog.coffee | 6 | 55 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
... | var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor() {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.filename = 'transaction.log';
}
start() {
return QFS.exist... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 36b6dd4b6d6c21126771ff7e795767a400542fd1 | 663 | https://github.com/buttercoin/buttercoin/blob/36b6dd4b6d6c21126771ff7e795767a400542fd1/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor() {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.filename = '... | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log()
... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 36b6dd4b6d6c21126771ff7e795767a400542fd1 | 663 | https://github.com/buttercoin/buttercoin/blob/36b6dd4b6d6c21126771ff7e795767a400542fd1/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:completion | completion | module.exports = class TransactionLog
constructor: ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log()
... | replay_log: (execute_transaction) =>
# XXX: This code is basically guaranteed to have chunking problems right now.
# Fix and then test rigorously!!!
@readstream = fs.createReadStream(@filename, {flags: "r"})
console.log 'GOT READSTREAM'
deferred = Q.defer()
Q.fcall =>
parts = []
... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 36b6dd4b6d6c21126771ff7e795767a400542fd1 | 663 | https://github.com/buttercoin/buttercoin/blob/36b6dd4b6d6c21126771ff7e795767a400542fd1/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:raw_corpus | raw_corpus | module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_l... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 87fcc36107030a18ba51279c419033a42f4cea44 | 663 | https://github.com/buttercoin/buttercoin/blob/87fcc36107030a18ba51279c419033a42f4cea44/lib/transactionlog.coffee | 6 | 55 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
... | var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(engine) {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.engine = engine;
this.filename = 'transaction.log';
}
... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 87fcc36107030a18ba51279c419033a42f4cea44 | 663 | https://github.com/buttercoin/buttercoin/blob/87fcc36107030a18ba51279c419033a42f4cea44/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(engine) {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.engine... | module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_l... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 87fcc36107030a18ba51279c419033a42f4cea44 | 663 | https://github.com/buttercoin/buttercoin/blob/87fcc36107030a18ba51279c419033a42f4cea44/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:completion | completion | module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_l... | replay_log: =>
# XXX: This code is basically guaranteed to have chunking problems right now.
# Fix and then test rigorously!!!
@readstream = fs.createReadStream(@filename, {flags: "r"})
console.log 'GOT READSTREAM'
deferred = Q.defer()
Q.fcall =>
parts = []
@readstream.on 'end', ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 87fcc36107030a18ba51279c419033a42f4cea44 | 663 | https://github.com/buttercoin/buttercoin/blob/87fcc36107030a18ba51279c419033a42f4cea44/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:2:raw_corpus | raw_corpus | if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.length == lenprefix
message = JSON.p... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 87fcc36107030a18ba51279c419033a42f4cea44 | 663 | https://github.com/buttercoin/buttercoin/blob/87fcc36107030a18ba51279c419033a42f4cea44/lib/transactionlog.coffee | 56 | 95 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:2:completion | completion | if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.length == lenprefix
message = JSON.p... | console.log 'ERROR'
.done()
return deferred.promise
record: (message) =>
console.log 'RECORDING', message
l = message.length
part = jspack.Pack('I', [l])
buf = Buffer.concat [ Buffer(part), Buffer(message) ]
writeq = Q.nfcall(fs.write, @writefd, buf, 0, buf.length, null)
console.l... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 87fcc36107030a18ba51279c419033a42f4cea44 | 663 | https://github.com/buttercoin/buttercoin/blob/87fcc36107030a18ba51279c419033a42f4cea44/lib/transactionlog.coffee | 56 | 95 |
buttercoin/buttercoin:lib/transactionlog.coffee:2:raw_corpus | raw_corpus | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/transactionlog.coffee | 56 | 105 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:2:completion | completion | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | @readstream.unshift(data)
.fail (err) =>
console.log 'Error reading transaction log: ', err
deferred.reject(err)
.done()
return deferred.promise
record: (message) =>
if not @writefd
console.log 'ERROR: transaction log not initialized. Did not record
message ', ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/transactionlog.coffee | 56 | 105 |
buttercoin/buttercoin:lib/transactionlog.coffee:3:raw_corpus | raw_corpus | flush: =>
Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED'
shutdown: =>
fs.closeSync(@writefd)
@writefd = null | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/transactionlog.coffee | 106 | 112 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
flush: =>
Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED'
shutdown: =>
fs.closeSync(@writefd)
@writefd = null
``` | ({
flush: () => {
return Q.nfcall(fs.fsync, this.writefd).then(() => {
return console.log('FLUSHED');
});
},
shutdown: () => {
fs.closeSync(this.writefd);
return this.writefd = null;
}
}); | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/transactionlog.coffee | 106 | 112 |
buttercoin/buttercoin:lib/transactionlog.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
flush: () => {
return Q.nfcall(fs.fsync, this.writefd).then(() => {
return console.log('FLUSHED');
});
},
shutdown: () => {
fs.closeSync(this.writefd);
return this.writefd = null;
}
});
``` | flush: =>
Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED'
shutdown: =>
fs.closeSync(@writefd)
@writefd = null | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/transactionlog.coffee | 106 | 112 |
buttercoin/buttercoin:lib/transactionlog.coffee:3:completion | completion | flush: =>
Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED' | shutdown: =>
fs.closeSync(@writefd)
@writefd = null | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/lib/transactionlog.coffee | 106 | 112 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:raw_corpus | raw_corpus | module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_l... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106 | 663 | https://github.com/buttercoin/buttercoin/blob/ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106/lib/transactionlog.coffee | 6 | 55 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
... | var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(engine) {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.engine = engine;
this.filename = 'transaction.log';
}
... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106 | 663 | https://github.com/buttercoin/buttercoin/blob/ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(engine) {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.engine... | module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_l... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106 | 663 | https://github.com/buttercoin/buttercoin/blob/ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:completion | completion | module.exports = class TransactionLog
constructor: (@engine) ->
@filename = 'transaction.log'
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_l... | # XXX: This code is basically guaranteed to have chunking problems right now.
# Fix and then test rigorously!!!
deferred = Q.defer()
Q.fcall =>
@readstream = fs.createReadStream(@filename, {flags: "r"})
console.log 'GOT READSTREAM'
parts = []
@readstream.on 'end', =>
cons... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106 | 663 | https://github.com/buttercoin/buttercoin/blob/ff68b45b0f3e1a1cfe1fc95ac478f714f7d38106/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:raw_corpus | raw_corpus | module.exports = class TransactionLog
constructor: (@engine, @filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log(... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 6 | 55 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class TransactionLog
constructor: (@engine, @filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
... | var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(engine, filename = 'transaction.log') {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_log.bind(this);
this.engine = engine;
this.filen... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TransactionLog;
module.exports = TransactionLog = class TransactionLog {
constructor(engine, filename = 'transaction.log') {
this.start = this.start.bind(this);
this.initialize_log = this.initialize_log.bind(this);
this.replay_log = this.replay_l... | module.exports = class TransactionLog
constructor: (@engine, @filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log(... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:1:completion | completion | module.exports = class TransactionLog
constructor: (@engine, @filename = 'transaction.log') ->
start: =>
return QFS.exists(@filename).then (retval) =>
if retval
console.log 'LOG EXISTS'
Q.fcall =>
@replay_log().then =>
# This is dangerous
@initialize_log(... | replay_log: =>
# XXX: This code is basically guaranteed to have chunking problems right now.
# Fix and then test rigorously!!!
@readstream = fs.createReadStream(@filename, {flags: "r"})
console.log 'GOT READSTREAM'
deferred = Q.defer()
Q.fcall =>
parts = []
@readstream.on 'end', ... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 6 | 55 |
buttercoin/buttercoin:lib/transactionlog.coffee:2:raw_corpus | raw_corpus | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 56 | 105 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:2:completion | completion | chunk = data.slice(4, 4 + lenprefix)
if data.length > 4 + lenprefix
rest = data.slice(4 + lenprefix)
else
rest = ''
console.log 'LENS', data.length, chunk.length, rest.length
console.log 'CHUNK', chunk.toString()
console.log 'rest', rest
if chunk.... | .fail =>
console.log 'ERROR'
.done()
return deferred.promise
record: (message) =>
if not @writefd
console.log 'ERROR: transaction log not initialized. Did not record
message ', message
return
console.log 'RECORDING', message
l = message.length
part = j... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 56 | 105 |
buttercoin/buttercoin:lib/transactionlog.coffee:3:raw_corpus | raw_corpus | Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED'
shutdown: =>
fs.closeSync(@writefd)
@writefd = null | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 106 | 111 | ||
buttercoin/buttercoin:lib/transactionlog.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED'
shutdown: =>
fs.closeSync(@writefd)
@writefd = null
``` | Q.nfcall(fs.fsync, this.writefd).then(() => {
return console.log('FLUSHED');
});
({
shutdown: () => {
fs.closeSync(this.writefd);
return this.writefd = null;
}
}); | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 106 | 111 |
buttercoin/buttercoin:lib/transactionlog.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Q.nfcall(fs.fsync, this.writefd).then(() => {
return console.log('FLUSHED');
});
({
shutdown: () => {
fs.closeSync(this.writefd);
return this.writefd = null;
}
});
``` | Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED'
shutdown: =>
fs.closeSync(@writefd)
@writefd = null | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 106 | 111 |
buttercoin/buttercoin:lib/transactionlog.coffee:3:completion | completion | Q.nfcall(fs.fsync, @writefd).then =>
console.log 'FLUSHED' | shutdown: =>
fs.closeSync(@writefd)
@writefd = null | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/transactionlog.coffee | MIT | 0e61ced53f96d1c50b7c3ffad03962c49fde3a7d | 663 | https://github.com/buttercoin/buttercoin/blob/0e61ced53f96d1c50b7c3ffad03962c49fde3a7d/lib/transactionlog.coffee | 106 | 111 |
jianliaoim/talk-os:talk-web/client/app/channel-more.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'channel-more'
mixins: [ mixinModal ]
propTypes:
_channelId: T.string.isRequired
_channelType: T.string.isRequired
onClose: T.func.isRequired
onInteClick: T.func.isRequired
channel: T.instanceOf(Immutable.Map).isRequired
getUserId: ->
que... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/channel-more.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-more.coffee | 24 | 73 | ||
jianliaoim/talk-os:talk-web/client/app/channel-more.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'channel-more'
mixins: [ mixinModal ]
propTypes:
_channelId: T.string.isRequired
_channelType: T.string.isRequired
onClose: T.func.isRequired
onInteClick: T.func.isRequired
channel: T.inst... | module.exports = React.createClass({
displayName: 'channel-more',
mixins: [mixinModal],
propTypes: {
_channelId: T.string.isRequired,
_channelType: T.string.isRequired,
onClose: T.func.isRequired,
onInteClick: T.func.isRequired,
channel: T.instanceOf(Immutable.Map).isRequired
},
getUserId:... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/channel-more.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-more.coffee | 24 | 73 |
jianliaoim/talk-os:talk-web/client/app/channel-more.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'channel-more',
mixins: [mixinModal],
propTypes: {
_channelId: T.string.isRequired,
_channelType: T.string.isRequired,
onClose: T.func.isRequired,
onInteClick: T.func.isRequired,
channel: T... | module.exports = React.createClass
displayName: 'channel-more'
mixins: [ mixinModal ]
propTypes:
_channelId: T.string.isRequired
_channelType: T.string.isRequired
onClose: T.func.isRequired
onInteClick: T.func.isRequired
channel: T.instanceOf(Immutable.Map).isRequired
getUserId: ->
que... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/channel-more.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-more.coffee | 24 | 73 |
jianliaoim/talk-os:talk-web/client/app/channel-more.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'channel-more'
mixins: [ mixinModal ]
propTypes:
_channelId: T.string.isRequired
_channelType: T.string.isRequired
onClose: T.func.isRequired
onInteClick: T.func.isRequired
channel: T.instanceOf(Immutable.Map).isRequired
getUserId: ->
que... | @onOpenModal MODAL_TYPE[0]
renderModal: ->
LightModal
name: 'channel-more'
show: @state.showModal
title: lang.getText @state.modalType
onCloseClick: @onCloseModal
switch @state.modalType
when MODAL_TYPE[0]
TopicDetails
topic: @props.channel
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/channel-more.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-more.coffee | 24 | 73 |
jianliaoim/talk-os:talk-web/client/app/channel-more.coffee:2:raw_corpus | raw_corpus | onClick: @onOpenIntePage
Icon name: 'square', size: 18
lang.getText 'integrations'
@renderModal()
renderStoryItems: ->
div className: 'channel-more',
if @getUserId() isnt @props.channel.get '_creatorId'
a
className: 'action flex-horiz flex-vcenter'
onClick:... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/channel-more.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-more.coffee | 74 | 100 | ||
jianliaoim/talk-os:talk-web/client/app/channel-more.coffee:2:completion | completion | onClick: @onOpenIntePage
Icon name: 'square', size: 18
lang.getText 'integrations'
@renderModal()
renderStoryItems: ->
div className: 'channel-more',
if @getUserId() isnt @props.channel.get '_creatorId'
a
className: 'action flex-horiz flex-vcenter'
onClick:... | else
null
a
className: 'action flex-horiz flex-vcenter'
onClick: @onDeleteStory
Icon name: 'trash'
lang.getText 'trash-story'
render: ->
switch @props._channelType
when 'room'
@renderRoomItems()
when 'story'
@renderStoryItems() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/channel-more.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/channel-more.coffee | 74 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.