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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dropbox/zxcvbn:zxcvbn.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var time, zxcvbn;
time = function() {
return (new Date()).getTime();
};
zxcvbn = function(password) {
var matches, result, start;
start = time();
matches = omnimatch(password);
result = minimum_entropy_match_sequence(password, matches);
result.calc_ti... | time = -> (new Date()).getTime()
zxcvbn = (password) ->
start = time()
matches = omnimatch password
result = minimum_entropy_match_sequence password, matches
result.calc_time = time() - start
result
window?.zxcvbn = zxcvbn | JavaScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | ffcf5aba63a686e63313cc55c5128b0e0974584f | 15,961 | https://github.com/dropbox/zxcvbn/blob/ffcf5aba63a686e63313cc55c5128b0e0974584f/zxcvbn.coffee | 1 | 10 |
dropbox/zxcvbn:zxcvbn.coffee:1:completion | completion | time = -> (new Date()).getTime()
zxcvbn = (password) ->
start = time()
matches = omnimatch password | result = minimum_entropy_match_sequence password, matches
result.calc_time = time() - start
result
window?.zxcvbn = zxcvbn | CoffeeScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | ffcf5aba63a686e63313cc55c5128b0e0974584f | 15,961 | https://github.com/dropbox/zxcvbn/blob/ffcf5aba63a686e63313cc55c5128b0e0974584f/zxcvbn.coffee | 1 | 10 |
dropbox/zxcvbn:zxcvbn.coffee:1:raw_corpus | raw_corpus | time = -> (new Date()).getTime()
zxcvbn = (password) ->
start = time()
matches = omnimatch password
best_match_data = minimum_entropy_match_sequence password, matches
best_match_data.calc_time = time() - start
best_match_data
window?.zxcvbn = zxcvbn | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 1efc11ecc36e293a6917429f43015a166cb3774f | 15,961 | https://github.com/dropbox/zxcvbn/blob/1efc11ecc36e293a6917429f43015a166cb3774f/zxcvbn.coffee | 1 | 10 | ||
dropbox/zxcvbn:zxcvbn.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
time = -> (new Date()).getTime()
zxcvbn = (password) ->
start = time()
matches = omnimatch password
best_match_data = minimum_entropy_match_sequence password, matches
best_match_data.calc_time = time() - start
best_match_data
window?.zxcvbn = zxcvbn
`... | var time, zxcvbn;
time = function() {
return (new Date()).getTime();
};
zxcvbn = function(password) {
var best_match_data, matches, start;
start = time();
matches = omnimatch(password);
best_match_data = minimum_entropy_match_sequence(password, matches);
best_match_data.calc_time = time() - start;
retur... | CoffeeScript | JavaScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 1efc11ecc36e293a6917429f43015a166cb3774f | 15,961 | https://github.com/dropbox/zxcvbn/blob/1efc11ecc36e293a6917429f43015a166cb3774f/zxcvbn.coffee | 1 | 10 |
dropbox/zxcvbn:zxcvbn.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var time, zxcvbn;
time = function() {
return (new Date()).getTime();
};
zxcvbn = function(password) {
var best_match_data, matches, start;
start = time();
matches = omnimatch(password);
best_match_data = minimum_entropy_match_sequence(password, matches)... | time = -> (new Date()).getTime()
zxcvbn = (password) ->
start = time()
matches = omnimatch password
best_match_data = minimum_entropy_match_sequence password, matches
best_match_data.calc_time = time() - start
best_match_data
window?.zxcvbn = zxcvbn | JavaScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 1efc11ecc36e293a6917429f43015a166cb3774f | 15,961 | https://github.com/dropbox/zxcvbn/blob/1efc11ecc36e293a6917429f43015a166cb3774f/zxcvbn.coffee | 1 | 10 |
dropbox/zxcvbn:zxcvbn.coffee:1:completion | completion | time = -> (new Date()).getTime()
zxcvbn = (password) ->
start = time()
matches = omnimatch password | best_match_data = minimum_entropy_match_sequence password, matches
best_match_data.calc_time = time() - start
best_match_data
window?.zxcvbn = zxcvbn | CoffeeScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 1efc11ecc36e293a6917429f43015a166cb3774f | 15,961 | https://github.com/dropbox/zxcvbn/blob/1efc11ecc36e293a6917429f43015a166cb3774f/zxcvbn.coffee | 1 | 10 |
dropbox/zxcvbn:zxcvbn.coffee:1:raw_corpus | raw_corpus | ###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace-deli... | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 5f5621f17883fa5feb68fd9ae530b896accea15b | 15,961 | https://github.com/dropbox/zxcvbn/blob/5f5621f17883fa5feb68fd9ae530b896accea15b/zxcvbn.coffee | 1 | 19 | ||
dropbox/zxcvbn:zxcvbn.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second... | /*
* zxcvbn: a password strength meter with solid math and clear assumptions.
*
* zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
* see the readme doc for details and examples.
*
* zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace... | CoffeeScript | JavaScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 5f5621f17883fa5feb68fd9ae530b896accea15b | 15,961 | https://github.com/dropbox/zxcvbn/blob/5f5621f17883fa5feb68fd9ae530b896accea15b/zxcvbn.coffee | 1 | 19 |
dropbox/zxcvbn:zxcvbn.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
* zxcvbn: a password strength meter with solid math and clear assumptions.
*
* zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
* see the readme doc for details and examples.
*
* zxcvbn takes an optional sec... | ###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace-deli... | JavaScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 5f5621f17883fa5feb68fd9ae530b896accea15b | 15,961 | https://github.com/dropbox/zxcvbn/blob/5f5621f17883fa5feb68fd9ae530b896accea15b/zxcvbn.coffee | 1 | 19 |
dropbox/zxcvbn:zxcvbn.coffee:1:completion | completion | ###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace-deli... | ###
zxcvbn = (password, other_user_inputs) ->
matching_attacks: ['bruteforce,36', 'letters,12-digits,2', 'word,436-word,1022-digit,2']
matches: [['correcthorse77'], ['correcthorse', '77'], ['correct', 'horse', '77']]
min_attack: 'word,436-word,1022-digit,2'
attack_time: 4430
quality: 3
tip: "words make grea... | CoffeeScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | 5f5621f17883fa5feb68fd9ae530b896accea15b | 15,961 | https://github.com/dropbox/zxcvbn/blob/5f5621f17883fa5feb68fd9ae530b896accea15b/zxcvbn.coffee | 1 | 19 |
dropbox/zxcvbn:zxcvbn.coffee:1:raw_corpus | raw_corpus | ###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace-deli... | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | c45114120a2969eb4d863696c3569fe8c1c756b3 | 15,961 | https://github.com/dropbox/zxcvbn/blob/c45114120a2969eb4d863696c3569fe8c1c756b3/zxcvbn.coffee | 1 | 18 | ||
dropbox/zxcvbn:zxcvbn.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second... | /*
* zxcvbn: a password strength meter with solid math and clear assumptions.
*
* zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
* see the readme doc for details and examples.
*
* zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace... | CoffeeScript | JavaScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | c45114120a2969eb4d863696c3569fe8c1c756b3 | 15,961 | https://github.com/dropbox/zxcvbn/blob/c45114120a2969eb4d863696c3569fe8c1c756b3/zxcvbn.coffee | 1 | 18 |
dropbox/zxcvbn:zxcvbn.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
* zxcvbn: a password strength meter with solid math and clear assumptions.
*
* zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
* see the readme doc for details and examples.
*
* zxcvbn takes an optional sec... | ###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace-deli... | JavaScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | c45114120a2969eb4d863696c3569fe8c1c756b3 | 15,961 | https://github.com/dropbox/zxcvbn/blob/c45114120a2969eb4d863696c3569fe8c1c756b3/zxcvbn.coffee | 1 | 18 |
dropbox/zxcvbn:zxcvbn.coffee:1:completion | completion | ###
# zxcvbn: a password strength meter with solid math and clear assumptions.
#
# zxcvbn takes one argument, a password, and returns a js object describing the password's strengh.
# see the readme doc for details and examples.
#
# zxcvbn takes an optional second argument, other_user_inputs, a string of whitespace-deli... | zxcvbn = (password, other_user_inputs) ->
matching_attacks: ['bruteforce,36', 'letters,12-digits,2', 'word,436-word,1022-digit,2']
matches: [['correcthorse77'], ['correcthorse', '77'], ['correct', 'horse', '77']]
min_attack: 'word,436-word,1022-digit,2'
attack_time: 4430
quality: 3
tip: "words make great pa... | CoffeeScript | CoffeeScript | dropbox/zxcvbn | zxcvbn.coffee | MIT | c45114120a2969eb4d863696c3569fe8c1c756b3 | 15,961 | https://github.com/dropbox/zxcvbn/blob/c45114120a2969eb4d863696c3569fe8c1c756b3/zxcvbn.coffee | 1 | 18 |
jianliaoim/talk-os:talk-web/client/handlers/settings.coffee:1:raw_corpus | raw_corpus | recorder = require 'actions-recorder'
query = require '../query'
dataRely = require '../network/data-rely'
deviceActions = require '../actions/device'
settingsActions = require '../actions/settings'
exports.update = (prefs) ->
store = recorder.getState()
# skips sending request when another request is performi... | CoffeeScript | jianliaoim/talk-os | talk-web/client/handlers/settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/settings.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/handlers/settings.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
recorder = require 'actions-recorder'
query = require '../query'
dataRely = require '../network/data-rely'
deviceActions = require '../actions/device'
settingsActions = require '../actions/settings'
exports.update = (prefs) ->
store = recorder.getState()
... | var dataRely, deviceActions, query, recorder, settingsActions;
recorder = require('actions-recorder');
query = require('../query');
dataRely = require('../network/data-rely');
deviceActions = require('../actions/device');
settingsActions = require('../actions/settings');
exports.update = function(prefs) {
var _... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/handlers/settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/settings.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/handlers/settings.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var dataRely, deviceActions, query, recorder, settingsActions;
recorder = require('actions-recorder');
query = require('../query');
dataRely = require('../network/data-rely');
deviceActions = require('../actions/device');
settingsActions = require('../actions/... | recorder = require 'actions-recorder'
query = require '../query'
dataRely = require '../network/data-rely'
deviceActions = require '../actions/device'
settingsActions = require '../actions/settings'
exports.update = (prefs) ->
store = recorder.getState()
# skips sending request when another request is performi... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/handlers/settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/settings.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/handlers/settings.coffee:1:completion | completion | recorder = require 'actions-recorder'
query = require '../query'
dataRely = require '../network/data-rely'
deviceActions = require '../actions/device'
settingsActions = require '../actions/settings'
exports.update = (prefs) ->
store = recorder.getState()
# skips sending request when another request is performi... | searchData = {_teamId, _creatorIds, _toIds, sort, isDirectMessage: true, limit: 20}
tagSearchData =
_teamId: _teamId
hasTag: true
limit: 20
sort: sort
_userId: _userId
if _roomId?
tagSearchData._roomId = _roomId
else if _toId?
tagSearchData.isDirectMessage = true
tagSearchData._cr... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/handlers/settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/settings.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/handlers/settings.coffee:2:raw_corpus | raw_corpus | deviceActions.networkLoading(info)
dataRely.ensure deps, ->
settingsActions.update prefs
deviceActions.networkLoaded(info) | CoffeeScript | jianliaoim/talk-os | talk-web/client/handlers/settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/settings.coffee | 51 | 54 | ||
jianliaoim/talk-os:talk-web/client/handlers/settings.coffee:2:completion | completion | deviceActions.networkLoading(info)
dataRely.ensure deps, -> | settingsActions.update prefs
deviceActions.networkLoaded(info) | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/handlers/settings.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/handlers/settings.coffee | 51 | 54 |
Pagedraw/pagedraw:deploy-checks/find-docs-with-mismatched-docids.coffee:1:raw_corpus | raw_corpus | require('../coffeescript-register-web')
_l = require 'lodash'
_l.extend process.env, {
DOCSERVER_HOST: 'https://pagedraw.firebaseio.com',
ALL_DOCS: "1"
}
{foreachDoc, serializeAddress} = require '../src/migrations/map_prod'
{Doc} = require '../src/doc'
# SETUP
no_metaserver_count = 0
mismatched_metaserver_... | CoffeeScript | Pagedraw/pagedraw | deploy-checks/find-docs-with-mismatched-docids.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/deploy-checks/find-docs-with-mismatched-docids.coffee | 1 | 32 | ||
Pagedraw/pagedraw:deploy-checks/find-docs-with-mismatched-docids.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
require('../coffeescript-register-web')
_l = require 'lodash'
_l.extend process.env, {
DOCSERVER_HOST: 'https://pagedraw.firebaseio.com',
ALL_DOCS: "1"
}
{foreachDoc, serializeAddress} = require '../src/migrations/map_prod'
{Doc} = require '../src/doc... | var Doc, _l, foreachDoc, mismatched_metaserver_count, no_metaserver_count, serializeAddress;
require('../coffeescript-register-web');
_l = require('lodash');
_l.extend(process.env, {
DOCSERVER_HOST: 'https://pagedraw.firebaseio.com',
ALL_DOCS: "1"
});
({foreachDoc, serializeAddress} = require('../src/migrations... | CoffeeScript | JavaScript | Pagedraw/pagedraw | deploy-checks/find-docs-with-mismatched-docids.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/deploy-checks/find-docs-with-mismatched-docids.coffee | 1 | 32 |
Pagedraw/pagedraw:deploy-checks/find-docs-with-mismatched-docids.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Doc, _l, foreachDoc, mismatched_metaserver_count, no_metaserver_count, serializeAddress;
require('../coffeescript-register-web');
_l = require('lodash');
_l.extend(process.env, {
DOCSERVER_HOST: 'https://pagedraw.firebaseio.com',
ALL_DOCS: "1"
});
({for... | require('../coffeescript-register-web')
_l = require 'lodash'
_l.extend process.env, {
DOCSERVER_HOST: 'https://pagedraw.firebaseio.com',
ALL_DOCS: "1"
}
{foreachDoc, serializeAddress} = require '../src/migrations/map_prod'
{Doc} = require '../src/doc'
# SETUP
no_metaserver_count = 0
mismatched_metaserver_... | JavaScript | CoffeeScript | Pagedraw/pagedraw | deploy-checks/find-docs-with-mismatched-docids.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/deploy-checks/find-docs-with-mismatched-docids.coffee | 1 | 32 |
Pagedraw/pagedraw:deploy-checks/find-docs-with-mismatched-docids.coffee:1:completion | completion | require('../coffeescript-register-web')
_l = require 'lodash'
_l.extend process.env, {
DOCSERVER_HOST: 'https://pagedraw.firebaseio.com',
ALL_DOCS: "1"
}
{foreachDoc, serializeAddress} = require '../src/migrations/map_prod'
{Doc} = require '../src/doc'
# SETUP
no_metaserver_count = 0
mismatched_metaserver_... | foreachDoc((docjson, addr) ->
# PER DOC
return if docjson == null
if not docjson.metaserver_id?
console.log "no metaserver_id", serializeAddress(addr)
no_metaserver_count += 1
else if addr.docRef? and String(docjson.metaserver_id) != String(addr.docRef.page_id)
console.log "met... | CoffeeScript | CoffeeScript | Pagedraw/pagedraw | deploy-checks/find-docs-with-mismatched-docids.coffee | MIT | aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e | 3,558 | https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/deploy-checks/find-docs-with-mismatched-docids.coffee | 1 | 32 |
Glavin001/atom-beautify:src/beautifiers/uncrustify/cfg.coffee:1:raw_corpus | raw_corpus | ###
Requires http://pear.php.net/package/PHP_Beautifier
###
"use strict"
fs = require("fs")
temp = require("temp").track()
possibleOptions = require "./possible-options.json"
module.exports = (options, cb) ->
text = ""
# Apply indent_size to output_tab_size
options.output_tab_size = options.output_tab_size or op... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/uncrustify/cfg.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/cfg.coffee | 1 | 50 | ||
Glavin001/atom-beautify:src/beautifiers/uncrustify/cfg.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires http://pear.php.net/package/PHP_Beautifier
###
"use strict"
fs = require("fs")
temp = require("temp").track()
possibleOptions = require "./possible-options.json"
module.exports = (options, cb) ->
text = ""
# Apply indent_size to output_tab_size
... | /*
Requires http://pear.php.net/package/PHP_Beautifier
*/
"use strict";
var fs, possibleOptions, temp;
fs = require("fs");
temp = require("temp").track();
possibleOptions = require("./possible-options.json");
module.exports = function(options, cb) {
var ic, isPossible, k, results, text, v, vs;
text = "";
// A... | CoffeeScript | JavaScript | Glavin001/atom-beautify | src/beautifiers/uncrustify/cfg.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/cfg.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/uncrustify/cfg.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires http://pear.php.net/package/PHP_Beautifier
*/
"use strict";
var fs, possibleOptions, temp;
fs = require("fs");
temp = require("temp").track();
possibleOptions = require("./possible-options.json");
module.exports = function(options, cb) {
var ic, i... | ###
Requires http://pear.php.net/package/PHP_Beautifier
###
"use strict"
fs = require("fs")
temp = require("temp").track()
possibleOptions = require "./possible-options.json"
module.exports = (options, cb) ->
text = ""
# Apply indent_size to output_tab_size
options.output_tab_size = options.output_tab_size or op... | JavaScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/uncrustify/cfg.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/cfg.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/uncrustify/cfg.coffee:1:completion | completion | ###
Requires http://pear.php.net/package/PHP_Beautifier
###
"use strict"
fs = require("fs")
temp = require("temp").track()
possibleOptions = require "./possible-options.json"
module.exports = (options, cb) ->
text = ""
# Apply indent_size to output_tab_size
options.output_tab_size = options.output_tab_size or op... | options.indent_with_tabs = 0 # Spaces only
else if ic is "\t"
options.indent_with_tabs = 2 # indent and align with tabs, using spaces when not on a tabstop
else
options.indent_with_tabs = 1 # indent with tabs to brace level, align with spaces
delete options.indent_char
# jshint ignore: end
# Remove ... | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/uncrustify/cfg.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/cfg.coffee | 1 | 50 |
Glavin001/atom-beautify:src/beautifiers/uncrustify/cfg.coffee:2:raw_corpus | raw_corpus | text += k + " = " + vs + "\n"
else
# console.log("removing #{k} option")
delete options[k]
# Create temp input file
temp.open
suffix: ".cfg"
, (err, info) ->
unless err
# Save current text to input file
fs.write info.fd, text or "", (err) ->
# console.log(err);
... | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/uncrustify/cfg.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/cfg.coffee | 51 | 75 | ||
Glavin001/atom-beautify:src/beautifiers/uncrustify/cfg.coffee:2:completion | completion | text += k + " = " + vs + "\n"
else
# console.log("removing #{k} option")
delete options[k]
# Create temp input file
temp.open
suffix: ".cfg"
, (err, info) ->
unless err
# Save current text to input file | fs.write info.fd, text or "", (err) ->
# console.log(err);
return cb(err) if err
fs.close info.fd, (err) ->
# console.log(err);
return cb(err) if err
cb null, info.path
else
cb err | CoffeeScript | CoffeeScript | Glavin001/atom-beautify | src/beautifiers/uncrustify/cfg.coffee | MIT | 41d5051b399f7fe11efd149504a232df16179d60 | 1,503 | https://github.com/Glavin001/atom-beautify/blob/41d5051b399f7fe11efd149504a232df16179d60/src/beautifiers/uncrustify/cfg.coffee | 51 | 75 |
technoweenie/coffee-resque:test/worker_wildcard_queues_test.coffee:1:raw_corpus | raw_corpus | require './helper'
conn = resque()
conn.enqueue 'abc', 'def'
conn.enqueue 'def', 'ghi'
queues = []
worker = conn.worker('*')
worker.on 'error', (err, worker, queue) ->
queues.push queue.toString()
if queues.length == 2
worker.end()
conn.end()
assert.deepEqual ['abc', 'def'], queues
worker.start()
pr... | CoffeeScript | technoweenie/coffee-resque | test/worker_wildcard_queues_test.coffee | MIT | cddec8828bb8bafcddb6b494651578e0ef1e5323 | 542 | https://github.com/technoweenie/coffee-resque/blob/cddec8828bb8bafcddb6b494651578e0ef1e5323/test/worker_wildcard_queues_test.coffee | 1 | 19 | ||
technoweenie/coffee-resque:test/worker_wildcard_queues_test.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
require './helper'
conn = resque()
conn.enqueue 'abc', 'def'
conn.enqueue 'def', 'ghi'
queues = []
worker = conn.worker('*')
worker.on 'error', (err, worker, queue) ->
queues.push queue.toString()
if queues.length == 2
worker.end()
conn.end()
as... | var conn, queues, worker;
require('./helper');
conn = resque();
conn.enqueue('abc', 'def');
conn.enqueue('def', 'ghi');
queues = [];
worker = conn.worker('*');
worker.on('error', function(err, worker, queue) {
queues.push(queue.toString());
if (queues.length === 2) {
worker.end();
conn.end();
ret... | CoffeeScript | JavaScript | technoweenie/coffee-resque | test/worker_wildcard_queues_test.coffee | MIT | cddec8828bb8bafcddb6b494651578e0ef1e5323 | 542 | https://github.com/technoweenie/coffee-resque/blob/cddec8828bb8bafcddb6b494651578e0ef1e5323/test/worker_wildcard_queues_test.coffee | 1 | 19 |
technoweenie/coffee-resque:test/worker_wildcard_queues_test.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var conn, queues, worker;
require('./helper');
conn = resque();
conn.enqueue('abc', 'def');
conn.enqueue('def', 'ghi');
queues = [];
worker = conn.worker('*');
worker.on('error', function(err, worker, queue) {
queues.push(queue.toString());
if (queues.le... | require './helper'
conn = resque()
conn.enqueue 'abc', 'def'
conn.enqueue 'def', 'ghi'
queues = []
worker = conn.worker('*')
worker.on 'error', (err, worker, queue) ->
queues.push queue.toString()
if queues.length == 2
worker.end()
conn.end()
assert.deepEqual ['abc', 'def'], queues
worker.start()
pr... | JavaScript | CoffeeScript | technoweenie/coffee-resque | test/worker_wildcard_queues_test.coffee | MIT | cddec8828bb8bafcddb6b494651578e0ef1e5323 | 542 | https://github.com/technoweenie/coffee-resque/blob/cddec8828bb8bafcddb6b494651578e0ef1e5323/test/worker_wildcard_queues_test.coffee | 1 | 19 |
technoweenie/coffee-resque:test/worker_wildcard_queues_test.coffee:1:completion | completion | require './helper'
conn = resque()
conn.enqueue 'abc', 'def'
conn.enqueue 'def', 'ghi'
queues = []
worker = conn.worker('*')
worker.on 'error', (err, worker, queue) -> | queues.push queue.toString()
if queues.length == 2
worker.end()
conn.end()
assert.deepEqual ['abc', 'def'], queues
worker.start()
process.on 'exit', ->
console.log '.' | CoffeeScript | CoffeeScript | technoweenie/coffee-resque | test/worker_wildcard_queues_test.coffee | MIT | cddec8828bb8bafcddb6b494651578e0ef1e5323 | 542 | https://github.com/technoweenie/coffee-resque/blob/cddec8828bb8bafcddb6b494651578e0ef1e5323/test/worker_wildcard_queues_test.coffee | 1 | 19 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:raw_corpus | raw_corpus | module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.dispose()
@colorList = null
observe: (key) ->
@sub... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.disp... | module.exports = {
subscriptions: null,
key: "activate-power-mode.particles.colours",
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
this.initConfigSubscribers();
return this.initList();
},
disable: function() {
var ref, ref1;
if ((ref = this.subscriptions) != null... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
subscriptions: null,
key: "activate-power-mode.particles.colours",
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
this.initConfigSubscribers();
return this.initList();
},
disable: function() {
va... | module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.dispose()
@colorList = null
observe: (key) ->
@sub... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:completion | completion | module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.dispose()
@colorList = null
observe: (key) ->
@sub... | @observe 'randomType'
hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia
c = v * s
h2 = (360.0*h) /60.0 # According to wikipedia, 0<h<360...
h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=h2<2 then return [x+m,c+m,m]
if 2<=... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:raw_corpus | raw_corpus | @seed = @seed - (@seed//1)
rgb = @hsvToRgb(@seed,1,1)
r = (rgb[0]*255)//1
g = (rgb[1]*255)//1
b = (rgb[2]*255)//1
"rgb(#{r},#{g},#{b})"
getRandomAllColor: ->
r = Math.floor(Math.random() * 256)
g = Math.floor(Math.random() * 256)
b = Math.floor(Math.random() * 256)
"rgb(#{r},#{g},... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 53 | 102 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:completion | completion | @seed = @seed - (@seed//1)
rgb = @hsvToRgb(@seed,1,1)
r = (rgb[0]*255)//1
g = (rgb[1]*255)//1
b = (rgb[2]*255)//1
"rgb(#{r},#{g},#{b})"
getRandomAllColor: ->
r = Math.floor(Math.random() * 256)
g = Math.floor(Math.random() * 256)
b = Math.floor(Math.random() * 256)
"rgb(#{r},#{g},... | getRandomSpawnGenerator: ->
if @conf['randomType'] == 'bright'
@seed = Math.random()
color = @getRandomBrightColor()
else
color = @getRandomAllColor()
loop
yield color
return
getColorAtCursorGenerator: (cursor, editorElement) ->
color = @getColorAtCursor cursor, editorEle... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 53 | 102 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:3:raw_corpus | raw_corpus | "rgb(255, 255, 255)"
if el
getComputedStyle(el).color
else
"rgb(255, 255, 255)"
generateColors: (cursor, editorElement) ->
colorType = @conf['type']
if (colorType == 'random')
return @getRandomGenerator()
else if colorType == 'fixed'
@getFixedColorGenerator()
else if ... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 103 | 132 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:3:completion | completion | "rgb(255, 255, 255)"
if el
getComputedStyle(el).color
else
"rgb(255, 255, 255)"
generateColors: (cursor, editorElement) ->
colorType = @conf['type']
if (colorType == 'random')
return @getRandomGenerator()
else if colorType == 'fixed'
@getFixedColorGenerator()
else if ... | else
@getColorAtCursorGenerator cursor, editorElement
selectColor: (code) ->
atom.config.set("#{@key}.type", code)
initList: ->
return if @colorList?
@colorList = require "./color-list"
@colorList.init this
@subscriptions.add atom.commands.add "atom-workspace",
"activate-power-mo... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ac060c2476ba8b323ca932eda97da9bc0c051b34 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ac060c2476ba8b323ca932eda97da9bc0c051b34/lib/color-helper.coffee | 103 | 132 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:raw_corpus | raw_corpus | module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.dispose()
@colorList = null
observe: (key) ->
@sub... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.disp... | module.exports = {
subscriptions: null,
key: "activate-power-mode.particles.colours",
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
this.initConfigSubscribers();
return this.initList();
},
disable: function() {
var ref, ref1;
if ((ref = this.subscriptions) != null... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
subscriptions: null,
key: "activate-power-mode.particles.colours",
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
this.initConfigSubscribers();
return this.initList();
},
disable: function() {
va... | module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.dispose()
@colorList = null
observe: (key) ->
@sub... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:completion | completion | module.exports =
subscriptions: null
key: "activate-power-mode.particles.colours"
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
@initList()
disable: ->
@subscriptions?.dispose()
@colorList?.dispose()
@colorList = null
observe: (key) ->
@sub... | hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia
c = v * s
h2 = (360.0*h) /60.0 # According to wikipedia, 0<h<360...
h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=h2<2 then return [x+m,c+m,m]
if 2<=h2<3 then return [m,c+m,x... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:raw_corpus | raw_corpus | seed = seed - (seed//1)
rgb = @hsvToRgb(seed,1,1)
r = (rgb[0]*255)//1
g = (rgb[1]*255)//1
b = (rgb[2]*255)//1
"rgb(#{r},#{g},#{b})"
getRandomGenerator: ->
seed = Math.random()
loop
yield @getRandomColor seed
return
getRandomSpawnGenerator: ->
seed = Math.random()
col... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 53 | 102 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:completion | completion | seed = seed - (seed//1)
rgb = @hsvToRgb(seed,1,1)
r = (rgb[0]*255)//1
g = (rgb[1]*255)//1
b = (rgb[2]*255)//1
"rgb(#{r},#{g},#{b})"
getRandomGenerator: ->
seed = Math.random()
loop
yield @getRandomColor seed
return
getRandomSpawnGenerator: ->
seed = Math.random()
col... | yield color
return
getColorAtCursor: (cursor, editorElement) ->
scope = cursor.getScopeDescriptor()
scope = scope.toString().replace(/\./g, '.syntax--')
try
el = editorElement.querySelector scope
catch error
"rgb(255, 255, 255)"
if el
getComputedStyle(el).color
else
... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 53 | 102 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:3:raw_corpus | raw_corpus | else
@getColorAtCursorGenerator cursor, editorElement
selectColor: (code) ->
atom.config.set("#{@key}.type", code)
initList: ->
return if @colorList?
@colorList = require "./color-list"
@colorList.init this
@subscriptions.add atom.commands.add "atom-workspace",
"activate-power-mo... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 103 | 117 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:3:completion | completion | else
@getColorAtCursorGenerator cursor, editorElement
selectColor: (code) ->
atom.config.set("#{@key}.type", code)
initList: -> | return if @colorList?
@colorList = require "./color-list"
@colorList.init this
@subscriptions.add atom.commands.add "atom-workspace",
"activate-power-mode:select-color": =>
@colorList.toggle() | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | be10ef58cb618c683f21154b6339607cea2aeb75 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/be10ef58cb618c683f21154b6339607cea2aeb75/lib/color-helper.coffee | 103 | 117 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:raw_corpus | raw_corpus | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@c... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 579ffc3fb8451dae9d067cab6669fb85bc23765a | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/579ffc3fb8451dae9d067cab6669fb85bc23765a/lib/color-helper.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-po... | module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
var ref;
return (ref = this.subscriptions) != null ? ref.dispose() : void 0;
},
observe: function(key) {
return th... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 579ffc3fb8451dae9d067cab6669fb85bc23765a | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/579ffc3fb8451dae9d067cab6669fb85bc23765a/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
var ref;
return (ref = this.subscriptions) != null ? ref.dispose() ... | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@c... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 579ffc3fb8451dae9d067cab6669fb85bc23765a | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/579ffc3fb8451dae9d067cab6669fb85bc23765a/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:completion | completion | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@c... | h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=h2<2 then return [x+m,c+m,m]
if 2<=h2<3 then return [m,c+m,x+m]
if 3<=h2<4 then return [m,x+m,c+m]
if 4<=h2<5 then return [x+m,m,c+m]
if 5<=h2<6 then return [c+m,m,x+m]
getFixedColorGener... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 579ffc3fb8451dae9d067cab6669fb85bc23765a | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/579ffc3fb8451dae9d067cab6669fb85bc23765a/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:raw_corpus | raw_corpus | b = (rgb[2]*255)//1
"rgb(#{r},#{g},#{b})"
getRandomGenerator: ->
seed = Math.random()
loop
yield @getRandomColor seed
return
getRandomSpawnGenerator: ->
seed = Math.random()
color = @getRandomColor seed
loop
yield color
return
getColorAtCursorGenerator: (cursor, ed... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 579ffc3fb8451dae9d067cab6669fb85bc23765a | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/579ffc3fb8451dae9d067cab6669fb85bc23765a/lib/color-helper.coffee | 53 | 100 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:completion | completion | b = (rgb[2]*255)//1
"rgb(#{r},#{g},#{b})"
getRandomGenerator: ->
seed = Math.random()
loop
yield @getRandomColor seed
return
getRandomSpawnGenerator: ->
seed = Math.random()
color = @getRandomColor seed
loop
yield color
return
getColorAtCursorGenerator: (cursor, ed... | getColorAtCursor: (cursor, editorElement) ->
scope = cursor.getScopeDescriptor()
scope = scope.toString().replace(/\./g, '.syntax--')
try
el = editorElement.querySelector scope
catch error
"rgb(255, 255, 255)"
if el
getComputedStyle(el).color
else
"rgb(255, 255, 255)"
... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 579ffc3fb8451dae9d067cab6669fb85bc23765a | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/579ffc3fb8451dae9d067cab6669fb85bc23765a/lib/color-helper.coffee | 53 | 100 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:raw_corpus | raw_corpus | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@c... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | aacb5c41dbf02a895abbfd874051d43aa5112ed9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/aacb5c41dbf02a895abbfd874051d43aa5112ed9/lib/color-helper.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-po... | module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
var ref;
return (ref = this.subscriptions) != null ? ref.dispose() : void 0;
},
observe: function(key) {
return th... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | aacb5c41dbf02a895abbfd874051d43aa5112ed9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/aacb5c41dbf02a895abbfd874051d43aa5112ed9/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
var ref;
return (ref = this.subscriptions) != null ? ref.dispose() ... | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@c... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | aacb5c41dbf02a895abbfd874051d43aa5112ed9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/aacb5c41dbf02a895abbfd874051d43aa5112ed9/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:completion | completion | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions?.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@c... | h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=h2<2 then return [x+m,c+m,m]
if 2<=h2<3 then return [m,c+m,x+m]
if 3<=h2<4 then return [m,x+m,c+m]
if 4<=h2<5 then return [x+m,m,c+m]
if 5<=h2<6 then return [c+m,m,x+m]
getFixedColorGener... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | aacb5c41dbf02a895abbfd874051d43aa5112ed9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/aacb5c41dbf02a895abbfd874051d43aa5112ed9/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:raw_corpus | raw_corpus | g = (rgb[1]*255)//1
b = (rgb[2]*255)//1
yield "rgb(#{r},#{g},#{b})"
return
getColorAtCursorGenerator: (cursor, editorElement) ->
color = @getColorAtCursor cursor, editorElement
loop
yield color
return
getColorAtCursor: (cursor, editorElement) ->
scope = cursor.getScopeDescri... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | aacb5c41dbf02a895abbfd874051d43aa5112ed9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/aacb5c41dbf02a895abbfd874051d43aa5112ed9/lib/color-helper.coffee | 53 | 86 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:completion | completion | g = (rgb[1]*255)//1
b = (rgb[2]*255)//1
yield "rgb(#{r},#{g},#{b})"
return
getColorAtCursorGenerator: (cursor, editorElement) ->
color = @getColorAtCursor cursor, editorElement
loop
yield color
return
getColorAtCursor: (cursor, editorElement) ->
scope = cursor.getScopeDescri... | el = editorElement.querySelector scope
catch error
"rgb(255, 255, 255)"
if el
getComputedStyle(el).color
else
"rgb(255, 255, 255)"
generateColors: (cursor, editorElement) ->
colorType = @conf['type']
if (colorType == 'random')
return @getRandomGenerator()
else if colo... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | aacb5c41dbf02a895abbfd874051d43aa5112ed9 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/aacb5c41dbf02a895abbfd874051d43aa5112ed9/lib/color-helper.coffee | 53 | 86 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:raw_corpus | raw_corpus | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@co... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 6a1580cda0a85ea3e919c14cde536f59fa5b3890 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/6a1580cda0a85ea3e919c14cde536f59fa5b3890/lib/color-helper.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-pow... | module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
return this.subscriptions.dispose();
},
observe: function(key) {
return this.subscriptions.add(atom.config.observe(`ac... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 6a1580cda0a85ea3e919c14cde536f59fa5b3890 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/6a1580cda0a85ea3e919c14cde536f59fa5b3890/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
return this.subscriptions.dispose();
},
observe: function(key) {
... | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@co... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 6a1580cda0a85ea3e919c14cde536f59fa5b3890 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/6a1580cda0a85ea3e919c14cde536f59fa5b3890/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:completion | completion | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@co... | h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=h2<2 then return [x+m,c+m,m]
if 2<=h2<3 then return [m,c+m,x+m]
if 3<=h2<4 then return [m,x+m,c+m]
if 4<=h2<5 then return [x+m,m,c+m]
if 5<=h2<6 then return [c+m,m,x+m]
getFixedColorGener... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 6a1580cda0a85ea3e919c14cde536f59fa5b3890 | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/6a1580cda0a85ea3e919c14cde536f59fa5b3890/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:raw_corpus | raw_corpus | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@co... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ef268c960138fd09ca9076e0766119d697f25dfa | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ef268c960138fd09ca9076e0766119d697f25dfa/lib/color-helper.coffee | 3 | 52 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-pow... | module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
return this.subscriptions.dispose();
},
observe: function(key) {
return this.subscriptions.add(atom.config.observe(`ac... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ef268c960138fd09ca9076e0766119d697f25dfa | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ef268c960138fd09ca9076e0766119d697f25dfa/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
subscriptions: null,
conf: [],
golden_ratio_conjugate: 0.618033988749895,
init: function() {
return this.initConfigSubscribers();
},
disable: function() {
return this.subscriptions.dispose();
},
observe: function(key) {
... | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@co... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ef268c960138fd09ca9076e0766119d697f25dfa | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ef268c960138fd09ca9076e0766119d697f25dfa/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:completion | completion | module.exports =
subscriptions: null
conf: []
golden_ratio_conjugate: 0.618033988749895
init: ->
@initConfigSubscribers()
disable: ->
@subscriptions.dispose()
observe: (key) ->
@subscriptions.add atom.config.observe(
"activate-power-mode.particles.colours.#{key}", (value) =>
@co... | h2 = (360.0*h) /60.0 # According to wikipedia, 0<h<360...
h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=h2<2 then return [x+m,c+m,m]
if 2<=h2<3 then return [m,c+m,x+m]
if 3<=h2<4 then return [m,x+m,c+m]
if 4<=h2<5 then return [x+m,m,c+m... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ef268c960138fd09ca9076e0766119d697f25dfa | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ef268c960138fd09ca9076e0766119d697f25dfa/lib/color-helper.coffee | 3 | 52 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:raw_corpus | raw_corpus | yield "rgb(#{r},#{g},#{b})"
return
getColorAtPosition: (editor, editorElement, screenPosition) ->
screenPosition = [screenPosition.row, screenPosition.column - 1]
bufferPosition = editor.bufferPositionForScreenPosition screenPosition
scope = editor.scopeDescriptorForBufferPosition bufferPosition
... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ef268c960138fd09ca9076e0766119d697f25dfa | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ef268c960138fd09ca9076e0766119d697f25dfa/lib/color-helper.coffee | 53 | 83 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:completion | completion | yield "rgb(#{r},#{g},#{b})"
return
getColorAtPosition: (editor, editorElement, screenPosition) ->
screenPosition = [screenPosition.row, screenPosition.column - 1]
bufferPosition = editor.bufferPositionForScreenPosition screenPosition
scope = editor.scopeDescriptorForBufferPosition bufferPosition
... | getComputedStyle(el).color
else
"rgb(255, 255, 255)"
generateColors: (editor, editorElement, screenPosition) ->
colorType = @conf['type']
if (colorType == 'random')
return @getRandomGenerator()
else if colorType == 'fixed'
color = @getFixedColor()
else
color = @getColorAtP... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ef268c960138fd09ca9076e0766119d697f25dfa | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ef268c960138fd09ca9076e0766119d697f25dfa/lib/color-helper.coffee | 53 | 83 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:raw_corpus | raw_corpus | module.exports =
golden_ratio_conjugate: 0.618033988749895
hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia
c = v * s
h2 = (360.0*h) /60.0 # According to wikipedia, 0<h<360...
h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 1 | 50 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
golden_ratio_conjugate: 0.618033988749895
hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia
c = v * s
h2 = (360.0*h) /60.0 # According to wikipedia, 0<h<360...
h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m ... | module.exports = {
golden_ratio_conjugate: 0.618033988749895,
hsvToRgb: function(h, s, v) { // HSV to RGB algorithm, as per wikipedia
var c, h2, h3, m, x;
c = v * s;
h2 = (360.0 * h) / 60.0; // According to wikipedia, 0<h<360...
h3 = Math.abs((h2 % 2) - 1.0);
x = c * (1.0 - h3);
m = v - c;
... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 1 | 50 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = {
golden_ratio_conjugate: 0.618033988749895,
hsvToRgb: function(h, s, v) { // HSV to RGB algorithm, as per wikipedia
var c, h2, h3, m, x;
c = v * s;
h2 = (360.0 * h) / 60.0; // According to wikipedia, 0<h<360...
h3 = Math.abs((h... | module.exports =
golden_ratio_conjugate: 0.618033988749895
hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia
c = v * s
h2 = (360.0*h) /60.0 # According to wikipedia, 0<h<360...
h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 1 | 50 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:1:completion | completion | module.exports =
golden_ratio_conjugate: 0.618033988749895
hsvToRgb: (h,s,v) -> # HSV to RGB algorithm, as per wikipedia
c = v * s
h2 = (360.0*h) /60.0 # According to wikipedia, 0<h<360...
h3 = Math.abs((h2%2) - 1.0)
x = c * (1.0 - h3)
m = v - c
if 0<=h2<1 then return [c+m,x+m,m]
if 1<=... | seed += @golden_ratio_conjugate
seed = seed - (seed//1)
rgb = @hsvToRgb(seed,1,1)
r = (rgb[0]*255)//1
g = (rgb[1]*255)//1
b = (rgb[2]*255)//1
yield "rgb(#{r},#{g},#{b})"
return
getColorAtPosition: (editor, editorElement, screenPosition) ->
screenPosition = [screenPosition... | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 1 | 50 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:raw_corpus | raw_corpus | generateColors: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
return @getRandomGenerator()
else if colorType == "fixed"
color = @getFixedColor()
else
color = @getColorAtPosition editor, editorElement, screenPosition
loop
... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 51 | 65 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
generateColors: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
return @getRandomGenerator()
else if colorType == "fixed"
color = @getFixedColor()
else
color = @getColorAtPosit... | ({
generateColors: function*(editor, editorElement, screenPosition) {
var color, colorType;
colorType = this.getConfig("type");
if (colorType === "random") {
return this.getRandomGenerator();
} else if (colorType === "fixed") {
color = this.getFixedColor();
} else {
color = this.... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 51 | 65 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
generateColors: function*(editor, editorElement, screenPosition) {
var color, colorType;
colorType = this.getConfig("type");
if (colorType === "random") {
return this.getRandomGenerator();
} else if (colorType === "fixed") {
color =... | generateColors: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
return @getRandomGenerator()
else if colorType == "fixed"
color = @getFixedColor()
else
color = @getColorAtPosition editor, editorElement, screenPosition
loop
... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 51 | 65 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:completion | completion | generateColors: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
return @getRandomGenerator()
else if colorType == "fixed"
color = @getFixedColor()
else | color = @getColorAtPosition editor, editorElement, screenPosition
loop
yield color
return
getConfig: (config) ->
atom.config.get "activate-power-mode.particles.colours.#{config}" | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | ec6533da69865979a508a47436e2aedb4dab4f4c | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/ec6533da69865979a508a47436e2aedb4dab4f4c/lib/color-helper.coffee | 51 | 65 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:raw_corpus | raw_corpus | getColor: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
@getRandomGenerator()
else if colorType == "fixed"
@getFixedColor()
else
@getColorAtPosition editor, editorElement, screenPosition
getConfig: (config) ->
atom.config.ge... | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/color-helper.coffee | 51 | 61 | ||
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getColor: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
@getRandomGenerator()
else if colorType == "fixed"
@getFixedColor()
else
@getColorAtPosition editor, editorElement, sc... | ({
getColor: function(editor, editorElement, screenPosition) {
var colorType;
colorType = this.getConfig("type");
if (colorType === "random") {
return this.getRandomGenerator();
} else if (colorType === "fixed") {
return this.getFixedColor();
} else {
return this.getColorAtPositi... | CoffeeScript | JavaScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/color-helper.coffee | 51 | 61 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
getColor: function(editor, editorElement, screenPosition) {
var colorType;
colorType = this.getConfig("type");
if (colorType === "random") {
return this.getRandomGenerator();
} else if (colorType === "fixed") {
return this.getFixedC... | getColor: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
@getRandomGenerator()
else if colorType == "fixed"
@getFixedColor()
else
@getColorAtPosition editor, editorElement, screenPosition
getConfig: (config) ->
atom.config.ge... | JavaScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/color-helper.coffee | 51 | 61 |
JoelBesada/activate-power-mode:lib/color-helper.coffee:2:completion | completion | getColor: (editor, editorElement, screenPosition) ->
colorType = @getConfig("type")
if (colorType == "random")
@getRandomGenerator()
else if colorType == "fixed" | @getFixedColor()
else
@getColorAtPosition editor, editorElement, screenPosition
getConfig: (config) ->
atom.config.get "activate-power-mode.particles.colours.#{config}" | CoffeeScript | CoffeeScript | JoelBesada/activate-power-mode | lib/color-helper.coffee | MIT | 98ff5a99d52aaae413104e3c3540f7a948c1be6e | 3,570 | https://github.com/JoelBesada/activate-power-mode/blob/98ff5a99d52aaae413104e3c3540f7a948c1be6e/lib/color-helper.coffee | 51 | 61 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:raw_corpus | raw_corpus | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_parsed_data: (parsed_data) =>
if parsed_data.operation.opid is @snapshot_opid
@info "SLAVE GOT SNAPS... | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/ews/s_protocol.coffee | 1 | 38 | ||
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_parsed_data: (parsed_data) =>
if parsed_data.oper... | var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
Protocol = require('./protocol');
module.exports = Slav... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/ews/s_protocol.coffee | 1 | 38 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
P... | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_parsed_data: (parsed_data) =>
if parsed_data.operation.opid is @snapshot_opid
@info "SLAVE GOT SNAPS... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/ews/s_protocol.coffee | 1 | 38 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:completion | completion | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_parsed_data: (parsed_data) =>
if parsed_data.operation.opid is @snapshot_opid
@info "SLAVE GOT SNAPS... | @info 'SLAVERESOLVING', parsed_data.operation.opid
# Received Operation from connected client. Execute it through the PCE.
Q.fcall =>
@options.pce.forward_operation( parsed_data.operation ).then (result) =>
@info 'PCE COMPLETED', result
# @engine_server.send_all( result )
.done()
... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a825a9ea31d695f8abb600f3f27ff635a839c0c2 | 663 | https://github.com/buttercoin/buttercoin/blob/a825a9ea31d695f8abb600f3f27ff635a839c0c2/lib/ews/s_protocol.coffee | 1 | 38 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:raw_corpus | raw_corpus | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | 0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03 | 663 | https://github.com/buttercoin/buttercoin/blob/0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03/lib/ews/s_protocol.coffee | 1 | 48 | ||
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to ... | var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
Protocol = require('./protocol');
module.exports = Slav... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | 0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03 | 663 | https://github.com/buttercoin/buttercoin/blob/0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03/lib/ews/s_protocol.coffee | 1 | 48 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
P... | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | 0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03 | 663 | https://github.com/buttercoin/buttercoin/blob/0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03/lib/ews/s_protocol.coffee | 1 | 48 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:completion | completion | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | return true
else if parsed_data.operation.kind is "SNAPSHOT_RESULT"
@info "IGNORING SNAPSHOT_RESULT"
return true
@info 'SLAVERESOLVING', parsed_data.operation.opid
# Received Operation from connected client. Execute it through the PCE.
Q.fcall =>
@options.pce.forward_operation( parsed... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | 0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03 | 663 | https://github.com/buttercoin/buttercoin/blob/0bfa62c2b810ec4efa4cd4aff6b27d1aa12e2a03/lib/ews/s_protocol.coffee | 1 | 48 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:raw_corpus | raw_corpus | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | eaa94ca8f63b9a3545b0f217d2e280ada471a47e | 663 | https://github.com/buttercoin/buttercoin/blob/eaa94ca8f63b9a3545b0f217d2e280ada471a47e/lib/ews/s_protocol.coffee | 1 | 32 | ||
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to ... | var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
Protocol = require('./protocol');
module.exports = Slav... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | eaa94ca8f63b9a3545b0f217d2e280ada471a47e | 663 | https://github.com/buttercoin/buttercoin/blob/eaa94ca8f63b9a3545b0f217d2e280ada471a47e/lib/ews/s_protocol.coffee | 1 | 32 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
P... | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | eaa94ca8f63b9a3545b0f217d2e280ada471a47e | 663 | https://github.com/buttercoin/buttercoin/blob/eaa94ca8f63b9a3545b0f217d2e280ada471a47e/lib/ews/s_protocol.coffee | 1 | 32 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:completion | completion | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | return true
handle_parsed_data: (parsed_data) =>
if parsed_data.operation.kind is "SNAPSHOT_RESULT"
@info "IGNORING SNAPSHOT_RESULT"
return true
@info 'SLAVERESOLVING', parsed_data.operation.opid
# Received Operation from connected client. Execute it through the PCE.
Q.fcall =>
@op... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | eaa94ca8f63b9a3545b0f217d2e280ada471a47e | 663 | https://github.com/buttercoin/buttercoin/blob/eaa94ca8f63b9a3545b0f217d2e280ada471a47e/lib/ews/s_protocol.coffee | 1 | 32 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:raw_corpus | raw_corpus | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a557f655fbd8ff5f37d35d3ca94d025585bb08d2 | 663 | https://github.com/buttercoin/buttercoin/blob/a557f655fbd8ff5f37d35d3ca94d025585bb08d2/lib/ews/s_protocol.coffee | 1 | 28 | ||
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to ... | var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
Protocol = require('./protocol');
module.exports = Slav... | CoffeeScript | JavaScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a557f655fbd8ff5f37d35d3ca94d025585bb08d2 | 663 | https://github.com/buttercoin/buttercoin/blob/a557f655fbd8ff5f37d35d3ca94d025585bb08d2/lib/ews/s_protocol.coffee | 1 | 28 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Protocol, Q, SlaveProtocol, helpers,
boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } };
helpers = require('enkihelpers');
Q = require('q');
P... | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | JavaScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a557f655fbd8ff5f37d35d3ca94d025585bb08d2 | 663 | https://github.com/buttercoin/buttercoin/blob/a557f655fbd8ff5f37d35d3ca94d025585bb08d2/lib/ews/s_protocol.coffee | 1 | 28 |
buttercoin/buttercoin:lib/ews/s_protocol.coffee:1:completion | completion | helpers = require('enkihelpers')
Q = require('q')
Protocol = require('./protocol')
module.exports = class SlaveProtocol extends Protocol
handle_open: (connection) =>
@protocol_ready.resolve(@)
handle_close: =>
# Protocol closed - tell the server to clean up.
@info 'SLAVEPROTOCOL CLOSED'
if @option... | @warn "Connection Lost Not Implemented"
return true
handle_parsed_data: (parsed_data) =>
@info 'SLAVERESOLVING', parsed_data.operation.opid
# Received Operation from connected client. Execute it through the PCE.
Q.fcall =>
@options.pce.forward_operation( parsed_data.operation ).then (result) =... | CoffeeScript | CoffeeScript | buttercoin/buttercoin | lib/ews/s_protocol.coffee | MIT | a557f655fbd8ff5f37d35d3ca94d025585bb08d2 | 663 | https://github.com/buttercoin/buttercoin/blob/a557f655fbd8ff5f37d35d3ca94d025585bb08d2/lib/ews/s_protocol.coffee | 1 | 28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.