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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cdglabs/apparatus:src/Util/Util.coffee:6:raw_corpus | raw_corpus | Util.clearTextFocus = ->
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur()
# =====================================================... | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 55 | 67 | ||
cdglabs/apparatus:src/Util/Util.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.clearTextFocus = ->
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur()
... | Util.clearTextFocus = function() {
var el, i, len, ref, results;
document.activeElement.blur();
window.getSelection().removeAllRanges();
document.body.focus();
ref = document.querySelectorAll(".CodeMirror-focused");
// Unfocus any focused Code Mirrors
results = [];
for (i = 0, len = ref.length; i < len;... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 55 | 67 |
cdglabs/apparatus:src/Util/Util.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.clearTextFocus = function() {
var el, i, len, ref, results;
document.activeElement.blur();
window.getSelection().removeAllRanges();
document.body.focus();
ref = document.querySelectorAll(".CodeMirror-focused");
// Unfocus any focused Code Mirrors
... | Util.clearTextFocus = ->
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur()
# =====================================================... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 55 | 67 |
cdglabs/apparatus:src/Util/Util.coffee:6:completion | completion | Util.clearTextFocus = ->
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors | for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur()
# =============================================================================
# IDs
# ============================================================================= | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 55 | 67 |
cdglabs/apparatus:src/Util/Util.coffee:7:raw_corpus | raw_corpus | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return Util.assignId(object, Util.generateId()) | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 69 | 71 | ||
cdglabs/apparatus:src/Util/Util.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return Util.assignId(object, Util.generateId())
``` | Util.getId = function(object) {
if (object.hasOwnProperty("id")) {
return object.id;
}
return Util.assignId(object, Util.generateId());
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 69 | 71 |
cdglabs/apparatus:src/Util/Util.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.getId = function(object) {
if (object.hasOwnProperty("id")) {
return object.id;
}
return Util.assignId(object, Util.generateId());
};
``` | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return Util.assignId(object, Util.generateId()) | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 69 | 71 |
cdglabs/apparatus:src/Util/Util.coffee:8:raw_corpus | raw_corpus | Util.assignId = (object, id) ->
return object.id = id
counter = 0 | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 73 | 76 | ||
cdglabs/apparatus:src/Util/Util.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.assignId = (object, id) ->
return object.id = id
counter = 0
``` | var counter;
Util.assignId = function(object, id) {
return object.id = id;
};
counter = 0; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 73 | 76 |
cdglabs/apparatus:src/Util/Util.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var counter;
Util.assignId = function(object, id) {
return object.id = id;
};
counter = 0;
``` | Util.assignId = (object, id) ->
return object.id = id
counter = 0 | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 73 | 76 |
cdglabs/apparatus:src/Util/Util.coffee:9:raw_corpus | raw_corpus | Util.generateId = ->
return "id" +
Math.random().toString(36).substr(2, 6) +
Date.now().toString(36) +
(counter++).toString(36)
# =============================================================================
# Numeric
# ============================================================================= | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 77 | 86 | ||
cdglabs/apparatus:src/Util/Util.coffee:9:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.generateId = ->
return "id" +
Math.random().toString(36).substr(2, 6) +
Date.now().toString(36) +
(counter++).toString(36)
# =============================================================================
# Numeric
# ===========================... | Util.generateId = function() {
return "id" + Math.random().toString(36).substr(2, 6) + Date.now().toString(36) + (counter++).toString(36);
};
// =============================================================================
// Numeric
// ============================================================================= | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 77 | 86 |
cdglabs/apparatus:src/Util/Util.coffee:9:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.generateId = function() {
return "id" + Math.random().toString(36).substr(2, 6) + Date.now().toString(36) + (counter++).toString(36);
};
// =============================================================================
// Numeric
// =========================... | Util.generateId = ->
return "id" +
Math.random().toString(36).substr(2, 6) +
Date.now().toString(36) +
(counter++).toString(36)
# =============================================================================
# Numeric
# ============================================================================= | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 77 | 86 |
cdglabs/apparatus:src/Util/Util.coffee:10:raw_corpus | raw_corpus | Util.quadrance = (p1, p2) ->
d = numeric['-'](p1, p2)
numeric.dot(d, d) | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 88 | 90 | ||
cdglabs/apparatus:src/Util/Util.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.quadrance = (p1, p2) ->
d = numeric['-'](p1, p2)
numeric.dot(d, d)
``` | Util.quadrance = function(p1, p2) {
var d;
d = numeric['-'](p1, p2);
return numeric.dot(d, d);
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 88 | 90 |
cdglabs/apparatus:src/Util/Util.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.quadrance = function(p1, p2) {
var d;
d = numeric['-'](p1, p2);
return numeric.dot(d, d);
};
``` | Util.quadrance = (p1, p2) ->
d = numeric['-'](p1, p2)
numeric.dot(d, d) | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 88 | 90 |
cdglabs/apparatus:src/Util/Util.coffee:11:raw_corpus | raw_corpus | Util.solve = (objective, startArgs) ->
if !_.all(startArgs, (arg) => _.isFinite(arg))
console.error(startArgs)
throw "Bad startArgs!"
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 92 | 102 | ||
cdglabs/apparatus:src/Util/Util.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.solve = (objective, startArgs) ->
if !_.all(startArgs, (arg) => _.isFinite(arg))
console.error(startArgs)
throw "Bad startArgs!"
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else... | Util.solve = function(objective, startArgs) {
var solution, uncmin;
if (!_.all(startArgs, (arg) => {
return _.isFinite(arg);
})) {
console.error(startArgs);
throw "Bad startArgs!";
}
uncmin = numeric.uncmin(objective, startArgs);
if (isNaN(uncmin.f)) {
console.warn("NaN");
return startAr... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 92 | 102 |
cdglabs/apparatus:src/Util/Util.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.solve = function(objective, startArgs) {
var solution, uncmin;
if (!_.all(startArgs, (arg) => {
return _.isFinite(arg);
})) {
console.error(startArgs);
throw "Bad startArgs!";
}
uncmin = numeric.uncmin(objective, startArgs);
if (isNaN(u... | Util.solve = (objective, startArgs) ->
if !_.all(startArgs, (arg) => _.isFinite(arg))
console.error(startArgs)
throw "Bad startArgs!"
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 92 | 102 |
cdglabs/apparatus:src/Util/Util.coffee:11:completion | completion | Util.solve = (objective, startArgs) ->
if !_.all(startArgs, (arg) => _.isFinite(arg))
console.error(startArgs)
throw "Bad startArgs!"
uncmin = numeric.uncmin(objective, startArgs) | if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 92 | 102 |
cdglabs/apparatus:src/Util/Util.coffee:12:raw_corpus | raw_corpus | Util.clamp = (x, min, max) ->
Math.max(min, Math.min(max, x))
# =============================================================================
# Precision
# ============================================================================= | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 104 | 109 | ||
cdglabs/apparatus:src/Util/Util.coffee:12:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.clamp = (x, min, max) ->
Math.max(min, Math.min(max, x))
# =============================================================================
# Precision
# =============================================================================
``` | Util.clamp = function(x, min, max) {
return Math.max(min, Math.min(max, x));
};
// =============================================================================
// Precision
// ============================================================================= | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 104 | 109 |
cdglabs/apparatus:src/Util/Util.coffee:12:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.clamp = function(x, min, max) {
return Math.max(min, Math.min(max, x));
};
// =============================================================================
// Precision
// =============================================================================
``` | Util.clamp = (x, min, max) ->
Math.max(min, Math.min(max, x))
# =============================================================================
# Precision
# ============================================================================= | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 104 | 109 |
cdglabs/apparatus:src/Util/Util.coffee:13:raw_corpus | raw_corpus | Util.precision = (x) ->
x = ""+x
# TODO: Deal with eE stuff.
decimalIndex = x.indexOf(".")
return 0 if decimalIndex == -1
return x.length - decimalIndex - 1 | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 111 | 116 | ||
cdglabs/apparatus:src/Util/Util.coffee:13:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.precision = (x) ->
x = ""+x
# TODO: Deal with eE stuff.
decimalIndex = x.indexOf(".")
return 0 if decimalIndex == -1
return x.length - decimalIndex - 1
``` | Util.precision = function(x) {
var decimalIndex;
x = "" + x;
// TODO: Deal with eE stuff.
decimalIndex = x.indexOf(".");
if (decimalIndex === -1) {
return 0;
}
return x.length - decimalIndex - 1;
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 111 | 116 |
cdglabs/apparatus:src/Util/Util.coffee:13:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.precision = function(x) {
var decimalIndex;
x = "" + x;
// TODO: Deal with eE stuff.
decimalIndex = x.indexOf(".");
if (decimalIndex === -1) {
return 0;
}
return x.length - decimalIndex - 1;
};
``` | Util.precision = (x) ->
x = ""+x
# TODO: Deal with eE stuff.
decimalIndex = x.indexOf(".")
return 0 if decimalIndex == -1
return x.length - decimalIndex - 1 | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 111 | 116 |
cdglabs/apparatus:src/Util/Util.coffee:13:completion | completion | Util.precision = (x) ->
x = ""+x
# TODO: Deal with eE stuff. | decimalIndex = x.indexOf(".")
return 0 if decimalIndex == -1
return x.length - decimalIndex - 1 | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 111 | 116 |
cdglabs/apparatus:src/Util/Util.coffee:14:raw_corpus | raw_corpus | Util.toPrecision = (x, precision) ->
x = Util.roundToPrecision(x, precision)
return x.toFixed(precision) | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 118 | 120 | ||
cdglabs/apparatus:src/Util/Util.coffee:14:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.toPrecision = (x, precision) ->
x = Util.roundToPrecision(x, precision)
return x.toFixed(precision)
``` | Util.toPrecision = function(x, precision) {
x = Util.roundToPrecision(x, precision);
return x.toFixed(precision);
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 118 | 120 |
cdglabs/apparatus:src/Util/Util.coffee:14:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.toPrecision = function(x, precision) {
x = Util.roundToPrecision(x, precision);
return x.toFixed(precision);
};
``` | Util.toPrecision = (x, precision) ->
x = Util.roundToPrecision(x, precision)
return x.toFixed(precision) | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 118 | 120 |
cdglabs/apparatus:src/Util/Util.coffee:15:raw_corpus | raw_corpus | Util.toMaxPrecision = (x, precision) ->
x = Util.toPrecision(x, precision)
if x.indexOf(".")
x = x.replace(/\.?0+$/, "")
return x | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 122 | 126 | ||
cdglabs/apparatus:src/Util/Util.coffee:15:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.toMaxPrecision = (x, precision) ->
x = Util.toPrecision(x, precision)
if x.indexOf(".")
x = x.replace(/\.?0+$/, "")
return x
``` | Util.toMaxPrecision = function(x, precision) {
x = Util.toPrecision(x, precision);
if (x.indexOf(".")) {
x = x.replace(/\.?0+$/, "");
}
return x;
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 122 | 126 |
cdglabs/apparatus:src/Util/Util.coffee:15:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.toMaxPrecision = function(x, precision) {
x = Util.toPrecision(x, precision);
if (x.indexOf(".")) {
x = x.replace(/\.?0+$/, "");
}
return x;
};
``` | Util.toMaxPrecision = (x, precision) ->
x = Util.toPrecision(x, precision)
if x.indexOf(".")
x = x.replace(/\.?0+$/, "")
return x | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 122 | 126 |
cdglabs/apparatus:src/Util/Util.coffee:15:completion | completion | Util.toMaxPrecision = (x, precision) ->
x = Util.toPrecision(x, precision) | if x.indexOf(".")
x = x.replace(/\.?0+$/, "")
return x | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 122 | 126 |
cdglabs/apparatus:src/Util/Util.coffee:16:raw_corpus | raw_corpus | Util.roundToPrecision = (x, precision) ->
multiplier = Math.pow(10, precision)
x = Math.round(x * multiplier) / multiplier
return x
# =============================================================================
# String
# =============================================================================
# stringMa... | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 128 | 139 | ||
cdglabs/apparatus:src/Util/Util.coffee:16:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.roundToPrecision = (x, precision) ->
multiplier = Math.pow(10, precision)
x = Math.round(x * multiplier) / multiplier
return x
# =============================================================================
# String
# ================================... | Util.roundToPrecision = function(x, precision) {
var multiplier;
multiplier = Math.pow(10, precision);
x = Math.round(x * multiplier) / multiplier;
return x;
};
// =============================================================================
// String
// ========================================================... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 128 | 139 |
cdglabs/apparatus:src/Util/Util.coffee:16:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.roundToPrecision = function(x, precision) {
var multiplier;
multiplier = Math.pow(10, precision);
x = Math.round(x * multiplier) / multiplier;
return x;
};
// =============================================================================
// String
// =... | Util.roundToPrecision = (x, precision) ->
multiplier = Math.pow(10, precision)
x = Math.round(x * multiplier) / multiplier
return x
# =============================================================================
# String
# =============================================================================
# stringMa... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 128 | 139 |
cdglabs/apparatus:src/Util/Util.coffee:17:raw_corpus | raw_corpus | Util.stringMatchIndices = (haystack, needle) ->
indices = []
cursor = -1
while true
cursor = haystack.indexOf(needle, cursor+1)
break if cursor == -1
indices.push(cursor)
return indices
# CodeMirror likes working with {line, ch} objects but sometimes it's easier
# to work with just a straight chara... | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 140 | 151 | ||
cdglabs/apparatus:src/Util/Util.coffee:17:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.stringMatchIndices = (haystack, needle) ->
indices = []
cursor = -1
while true
cursor = haystack.indexOf(needle, cursor+1)
break if cursor == -1
indices.push(cursor)
return indices
# CodeMirror likes working with {line, ch} objects but s... | Util.stringMatchIndices = function(haystack, needle) {
var cursor, indices;
indices = [];
cursor = -1;
while (true) {
cursor = haystack.indexOf(needle, cursor + 1);
if (cursor === -1) {
break;
}
indices.push(cursor);
}
return indices;
};
// CodeMirror likes working with {line, ch} obj... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 140 | 151 |
cdglabs/apparatus:src/Util/Util.coffee:17:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.stringMatchIndices = function(haystack, needle) {
var cursor, indices;
indices = [];
cursor = -1;
while (true) {
cursor = haystack.indexOf(needle, cursor + 1);
if (cursor === -1) {
break;
}
indices.push(cursor);
}
return indic... | Util.stringMatchIndices = (haystack, needle) ->
indices = []
cursor = -1
while true
cursor = haystack.indexOf(needle, cursor+1)
break if cursor == -1
indices.push(cursor)
return indices
# CodeMirror likes working with {line, ch} objects but sometimes it's easier
# to work with just a straight chara... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 140 | 151 |
cdglabs/apparatus:src/Util/Util.coffee:17:completion | completion | Util.stringMatchIndices = (haystack, needle) ->
indices = []
cursor = -1
while true
cursor = haystack.indexOf(needle, cursor+1)
break if cursor == -1 | indices.push(cursor)
return indices
# CodeMirror likes working with {line, ch} objects but sometimes it's easier
# to work with just a straight character index. This function converts a
# character index to a {line, ch} by counting new lines in the string. | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 140 | 151 |
cdglabs/apparatus:src/Util/Util.coffee:18:raw_corpus | raw_corpus | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length}
Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
new RegExp("^#{Util.numberFragment}$")
Util.rangedNumberR... | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 152 | 162 | ||
cdglabs/apparatus:src/Util/Util.coffee:18:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length}
Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
... | Util.charToLineCh = function(string, char) {
var lines, stringUpToChar;
stringUpToChar = string.substr(0, char);
lines = stringUpToChar.split("\n");
return {
line: lines.length - 1,
ch: _.last(lines).length
};
};
Util.numberFragment = "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?";
Util.numberRegExp = new... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 152 | 162 |
cdglabs/apparatus:src/Util/Util.coffee:18:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.charToLineCh = function(string, char) {
var lines, stringUpToChar;
stringUpToChar = string.substr(0, char);
lines = stringUpToChar.split("\n");
return {
line: lines.length - 1,
ch: _.last(lines).length
};
};
Util.numberFragment = "[-+]?[0-9]... | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length}
Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
new RegExp("^#{Util.numberFragment}$")
Util.rangedNumberR... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 152 | 162 |
cdglabs/apparatus:src/Util/Util.coffee:18:completion | completion | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length} | Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
new RegExp("^#{Util.numberFragment}$")
Util.rangedNumberRegExp =
new RegExp("^(#{Util.numberFragment}){(#{Util.numberFragment})-(#{Util.numberFragment})}$") | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 152 | 162 |
cdglabs/apparatus:src/Util/Util.coffee:20:raw_corpus | raw_corpus | Util.matchRangedNumberString = (string) ->
maybeMatch = string.match(Util.rangedNumberRegExp)
if not maybeMatch then return maybeMatch # no match
return {
valueStr: maybeMatch[1]
lowStr: maybeMatch[3]
highStr: maybeMatch[5]
} | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 167 | 174 | ||
cdglabs/apparatus:src/Util/Util.coffee:20:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.matchRangedNumberString = (string) ->
maybeMatch = string.match(Util.rangedNumberRegExp)
if not maybeMatch then return maybeMatch # no match
return {
valueStr: maybeMatch[1]
lowStr: maybeMatch[3]
highStr: maybeMatch[5]
}
``` | Util.matchRangedNumberString = function(string) {
var maybeMatch;
maybeMatch = string.match(Util.rangedNumberRegExp);
if (!maybeMatch) {
return maybeMatch; // no match
}
return {
valueStr: maybeMatch[1],
lowStr: maybeMatch[3],
highStr: maybeMatch[5]
};
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 167 | 174 |
cdglabs/apparatus:src/Util/Util.coffee:20:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.matchRangedNumberString = function(string) {
var maybeMatch;
maybeMatch = string.match(Util.rangedNumberRegExp);
if (!maybeMatch) {
return maybeMatch; // no match
}
return {
valueStr: maybeMatch[1],
lowStr: maybeMatch[3],
highStr: may... | Util.matchRangedNumberString = (string) ->
maybeMatch = string.match(Util.rangedNumberRegExp)
if not maybeMatch then return maybeMatch # no match
return {
valueStr: maybeMatch[1]
lowStr: maybeMatch[3]
highStr: maybeMatch[5]
} | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 167 | 174 |
cdglabs/apparatus:src/Util/Util.coffee:22:raw_corpus | raw_corpus | Util.isKeywordLiteral = (string) ->
return (
string == "true" or string == "false" or
string == "null" or string == "undefined"
) | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 179 | 183 | ||
cdglabs/apparatus:src/Util/Util.coffee:22:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.isKeywordLiteral = (string) ->
return (
string == "true" or string == "false" or
string == "null" or string == "undefined"
)
``` | Util.isKeywordLiteral = function(string) {
return string === "true" || string === "false" || string === "null" || string === "undefined";
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 179 | 183 |
cdglabs/apparatus:src/Util/Util.coffee:22:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.isKeywordLiteral = function(string) {
return string === "true" || string === "false" || string === "null" || string === "undefined";
};
``` | Util.isKeywordLiteral = (string) ->
return (
string == "true" or string == "false" or
string == "null" or string == "undefined"
) | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 179 | 183 |
cdglabs/apparatus:src/Util/Util.coffee:22:completion | completion | Util.isKeywordLiteral = (string) ->
return ( | string == "true" or string == "false" or
string == "null" or string == "undefined"
) | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 179 | 183 |
cdglabs/apparatus:src/Util/Util.coffee:23:raw_corpus | raw_corpus | Util.escapeHtml = (str) ->
div = document.createElement("div")
div.appendChild(document.createTextNode(str))
return div.innerHTML | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 185 | 188 | ||
cdglabs/apparatus:src/Util/Util.coffee:23:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.escapeHtml = (str) ->
div = document.createElement("div")
div.appendChild(document.createTextNode(str))
return div.innerHTML
``` | Util.escapeHtml = function(str) {
var div;
div = document.createElement("div");
div.appendChild(document.createTextNode(str));
return div.innerHTML;
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 185 | 188 |
cdglabs/apparatus:src/Util/Util.coffee:23:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.escapeHtml = function(str) {
var div;
div = document.createElement("div");
div.appendChild(document.createTextNode(str));
return div.innerHTML;
};
``` | Util.escapeHtml = (str) ->
div = document.createElement("div")
div.appendChild(document.createTextNode(str))
return div.innerHTML | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 185 | 188 |
cdglabs/apparatus:src/Util/Util.coffee:23:completion | completion | Util.escapeHtml = (str) ->
div = document.createElement("div") | div.appendChild(document.createTextNode(str))
return div.innerHTML | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 107e0c2db5a0adf0f1c3b49f16f7625cff4e523b | 1,052 | https://github.com/cdglabs/apparatus/blob/107e0c2db5a0adf0f1c3b49f16f7625cff4e523b/src/Util/Util.coffee | 185 | 188 |
cdglabs/apparatus:src/Util/Util.coffee:11:raw_corpus | raw_corpus | Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | c8c4c15d42f82516d381ab72a4685708797c2aea | 1,052 | https://github.com/cdglabs/apparatus/blob/c8c4c15d42f82516d381ab72a4685708797c2aea/src/Util/Util.coffee | 92 | 99 | ||
cdglabs/apparatus:src/Util/Util.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution
``` | Util.solve = function(objective, startArgs) {
var solution, uncmin;
uncmin = numeric.uncmin(objective, startArgs);
if (isNaN(uncmin.f)) {
console.warn("NaN");
return startArgs;
} else {
solution = uncmin.solution;
return solution;
}
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | c8c4c15d42f82516d381ab72a4685708797c2aea | 1,052 | https://github.com/cdglabs/apparatus/blob/c8c4c15d42f82516d381ab72a4685708797c2aea/src/Util/Util.coffee | 92 | 99 |
cdglabs/apparatus:src/Util/Util.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.solve = function(objective, startArgs) {
var solution, uncmin;
uncmin = numeric.uncmin(objective, startArgs);
if (isNaN(uncmin.f)) {
console.warn("NaN");
return startArgs;
} else {
solution = uncmin.solution;
return solution;
}
};
``` | Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | c8c4c15d42f82516d381ab72a4685708797c2aea | 1,052 | https://github.com/cdglabs/apparatus/blob/c8c4c15d42f82516d381ab72a4685708797c2aea/src/Util/Util.coffee | 92 | 99 |
cdglabs/apparatus:src/Util/Util.coffee:11:completion | completion | Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN" | return startArgs
else
solution = uncmin.solution
return solution | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | c8c4c15d42f82516d381ab72a4685708797c2aea | 1,052 | https://github.com/cdglabs/apparatus/blob/c8c4c15d42f82516d381ab72a4685708797c2aea/src/Util/Util.coffee | 92 | 99 |
cdglabs/apparatus:src/Util/Util.coffee:18:raw_corpus | raw_corpus | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length}
Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
new RegExp("^#{Util.numberFragment}$") | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1 | 1,052 | https://github.com/cdglabs/apparatus/blob/2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1/src/Util/Util.coffee | 149 | 157 | ||
cdglabs/apparatus:src/Util/Util.coffee:18:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length}
Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
... | Util.charToLineCh = function(string, char) {
var lines, stringUpToChar;
stringUpToChar = string.substr(0, char);
lines = stringUpToChar.split("\n");
return {
line: lines.length - 1,
ch: _.last(lines).length
};
};
Util.numberFragment = "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?";
Util.numberRegExp = new... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1 | 1,052 | https://github.com/cdglabs/apparatus/blob/2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1/src/Util/Util.coffee | 149 | 157 |
cdglabs/apparatus:src/Util/Util.coffee:18:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.charToLineCh = function(string, char) {
var lines, stringUpToChar;
stringUpToChar = string.substr(0, char);
lines = stringUpToChar.split("\n");
return {
line: lines.length - 1,
ch: _.last(lines).length
};
};
Util.numberFragment = "[-+]?[0-9]... | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length}
Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
new RegExp("^#{Util.numberFragment}$") | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1 | 1,052 | https://github.com/cdglabs/apparatus/blob/2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1/src/Util/Util.coffee | 149 | 157 |
cdglabs/apparatus:src/Util/Util.coffee:18:completion | completion | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length} | Util.numberFragment =
"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
Util.numberRegExp =
new RegExp("^#{Util.numberFragment}$") | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1 | 1,052 | https://github.com/cdglabs/apparatus/blob/2bfb14eff28c6d2ef6280c09a84f9f642c4ef2e1/src/Util/Util.coffee | 149 | 157 |
cdglabs/apparatus:src/Util/Util.coffee:18:raw_corpus | raw_corpus | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length} | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 48c7ad9fd3e34486c1272874482685ef019b3d33 | 1,052 | https://github.com/cdglabs/apparatus/blob/48c7ad9fd3e34486c1272874482685ef019b3d33/src/Util/Util.coffee | 149 | 152 | ||
cdglabs/apparatus:src/Util/Util.coffee:18:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length}
``` | Util.charToLineCh = function(string, char) {
var lines, stringUpToChar;
stringUpToChar = string.substr(0, char);
lines = stringUpToChar.split("\n");
return {
line: lines.length - 1,
ch: _.last(lines).length
};
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 48c7ad9fd3e34486c1272874482685ef019b3d33 | 1,052 | https://github.com/cdglabs/apparatus/blob/48c7ad9fd3e34486c1272874482685ef019b3d33/src/Util/Util.coffee | 149 | 152 |
cdglabs/apparatus:src/Util/Util.coffee:18:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.charToLineCh = function(string, char) {
var lines, stringUpToChar;
stringUpToChar = string.substr(0, char);
lines = stringUpToChar.split("\n");
return {
line: lines.length - 1,
ch: _.last(lines).length
};
};
``` | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char)
lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length} | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 48c7ad9fd3e34486c1272874482685ef019b3d33 | 1,052 | https://github.com/cdglabs/apparatus/blob/48c7ad9fd3e34486c1272874482685ef019b3d33/src/Util/Util.coffee | 149 | 152 |
cdglabs/apparatus:src/Util/Util.coffee:18:completion | completion | Util.charToLineCh = (string, char) ->
stringUpToChar = string.substr(0, char) | lines = stringUpToChar.split("\n")
return {line: lines.length-1, ch: _.last(lines).length} | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 48c7ad9fd3e34486c1272874482685ef019b3d33 | 1,052 | https://github.com/cdglabs/apparatus/blob/48c7ad9fd3e34486c1272874482685ef019b3d33/src/Util/Util.coffee | 149 | 152 |
cdglabs/apparatus:src/Util/Util.coffee:11:raw_corpus | raw_corpus | Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution
# =============================================================================
# Precision
# ==============... | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | cbae82310f699a921097a265e69deeb585dc9889 | 1,052 | https://github.com/cdglabs/apparatus/blob/cbae82310f699a921097a265e69deeb585dc9889/src/Util/Util.coffee | 92 | 104 | ||
cdglabs/apparatus:src/Util/Util.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution
# =================================================... | Util.solve = function(objective, startArgs) {
var solution, uncmin;
uncmin = numeric.uncmin(objective, startArgs);
if (isNaN(uncmin.f)) {
console.warn("NaN");
return startArgs;
} else {
solution = uncmin.solution;
return solution;
}
};
// ======================================================... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | cbae82310f699a921097a265e69deeb585dc9889 | 1,052 | https://github.com/cdglabs/apparatus/blob/cbae82310f699a921097a265e69deeb585dc9889/src/Util/Util.coffee | 92 | 104 |
cdglabs/apparatus:src/Util/Util.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.solve = function(objective, startArgs) {
var solution, uncmin;
uncmin = numeric.uncmin(objective, startArgs);
if (isNaN(uncmin.f)) {
console.warn("NaN");
return startArgs;
} else {
solution = uncmin.solution;
return solution;
}
};
//... | Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else
solution = uncmin.solution
return solution
# =============================================================================
# Precision
# ==============... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | cbae82310f699a921097a265e69deeb585dc9889 | 1,052 | https://github.com/cdglabs/apparatus/blob/cbae82310f699a921097a265e69deeb585dc9889/src/Util/Util.coffee | 92 | 104 |
cdglabs/apparatus:src/Util/Util.coffee:11:completion | completion | Util.solve = (objective, startArgs) ->
uncmin = numeric.uncmin(objective, startArgs)
if isNaN(uncmin.f)
console.warn "NaN"
return startArgs
else | solution = uncmin.solution
return solution
# =============================================================================
# Precision
# ============================================================================= | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | cbae82310f699a921097a265e69deeb585dc9889 | 1,052 | https://github.com/cdglabs/apparatus/blob/cbae82310f699a921097a265e69deeb585dc9889/src/Util/Util.coffee | 92 | 104 |
cdglabs/apparatus:src/Util/Util.coffee:4:raw_corpus | raw_corpus | Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur() | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 8f15e0512716b1d1f30c8d902506788d3553a77c | 1,052 | https://github.com/cdglabs/apparatus/blob/8f15e0512716b1d1f30c8d902506788d3553a77c/src/Util/Util.coffee | 36 | 44 | ||
cdglabs/apparatus:src/Util/Util.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.... | Util.mouseDownPreventDefault = function(e) {
var el, i, len, ref, results;
e.preventDefault();
document.activeElement.blur();
window.getSelection().removeAllRanges();
document.body.focus();
ref = document.querySelectorAll(".CodeMirror-focused");
// Unfocus any focused Code Mirrors
results = [];
for (i... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 8f15e0512716b1d1f30c8d902506788d3553a77c | 1,052 | https://github.com/cdglabs/apparatus/blob/8f15e0512716b1d1f30c8d902506788d3553a77c/src/Util/Util.coffee | 36 | 44 |
cdglabs/apparatus:src/Util/Util.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.mouseDownPreventDefault = function(e) {
var el, i, len, ref, results;
e.preventDefault();
document.activeElement.blur();
window.getSelection().removeAllRanges();
document.body.focus();
ref = document.querySelectorAll(".CodeMirror-focused");
// Un... | Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur() | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 8f15e0512716b1d1f30c8d902506788d3553a77c | 1,052 | https://github.com/cdglabs/apparatus/blob/8f15e0512716b1d1f30c8d902506788d3553a77c/src/Util/Util.coffee | 36 | 44 |
cdglabs/apparatus:src/Util/Util.coffee:4:completion | completion | Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges() | document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur() | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 8f15e0512716b1d1f30c8d902506788d3553a77c | 1,052 | https://github.com/cdglabs/apparatus/blob/8f15e0512716b1d1f30c8d902506788d3553a77c/src/Util/Util.coffee | 36 | 44 |
cdglabs/apparatus:src/Util/Util.coffee:6:raw_corpus | raw_corpus | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return object.id = Util.generateId()
counter = 0 | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 1042e63a5f87ff88ad491d67258903fce8322f2f | 1,052 | https://github.com/cdglabs/apparatus/blob/1042e63a5f87ff88ad491d67258903fce8322f2f/src/Util/Util.coffee | 62 | 66 | ||
cdglabs/apparatus:src/Util/Util.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return object.id = Util.generateId()
counter = 0
``` | var counter;
Util.getId = function(object) {
if (object.hasOwnProperty("id")) {
return object.id;
}
return object.id = Util.generateId();
};
counter = 0; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 1042e63a5f87ff88ad491d67258903fce8322f2f | 1,052 | https://github.com/cdglabs/apparatus/blob/1042e63a5f87ff88ad491d67258903fce8322f2f/src/Util/Util.coffee | 62 | 66 |
cdglabs/apparatus:src/Util/Util.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var counter;
Util.getId = function(object) {
if (object.hasOwnProperty("id")) {
return object.id;
}
return object.id = Util.generateId();
};
counter = 0;
``` | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return object.id = Util.generateId()
counter = 0 | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 1042e63a5f87ff88ad491d67258903fce8322f2f | 1,052 | https://github.com/cdglabs/apparatus/blob/1042e63a5f87ff88ad491d67258903fce8322f2f/src/Util/Util.coffee | 62 | 66 |
cdglabs/apparatus:src/Util/Util.coffee:6:completion | completion | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id") | return object.id = Util.generateId()
counter = 0 | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 1042e63a5f87ff88ad491d67258903fce8322f2f | 1,052 | https://github.com/cdglabs/apparatus/blob/1042e63a5f87ff88ad491d67258903fce8322f2f/src/Util/Util.coffee | 62 | 66 |
cdglabs/apparatus:src/Util/Util.coffee:13:raw_corpus | raw_corpus | Util.roundToPrecision = (x, precision) ->
multiplier = Math.pow(10, precision)
x = Math.round(x * multiplier) / multiplier
return x | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | f502f5c28dea77e3fdbffdb30718c9508eb4582a | 1,052 | https://github.com/cdglabs/apparatus/blob/f502f5c28dea77e3fdbffdb30718c9508eb4582a/src/Util/Util.coffee | 113 | 116 | ||
cdglabs/apparatus:src/Util/Util.coffee:13:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.roundToPrecision = (x, precision) ->
multiplier = Math.pow(10, precision)
x = Math.round(x * multiplier) / multiplier
return x
``` | Util.roundToPrecision = function(x, precision) {
var multiplier;
multiplier = Math.pow(10, precision);
x = Math.round(x * multiplier) / multiplier;
return x;
}; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | f502f5c28dea77e3fdbffdb30718c9508eb4582a | 1,052 | https://github.com/cdglabs/apparatus/blob/f502f5c28dea77e3fdbffdb30718c9508eb4582a/src/Util/Util.coffee | 113 | 116 |
cdglabs/apparatus:src/Util/Util.coffee:13:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.roundToPrecision = function(x, precision) {
var multiplier;
multiplier = Math.pow(10, precision);
x = Math.round(x * multiplier) / multiplier;
return x;
};
``` | Util.roundToPrecision = (x, precision) ->
multiplier = Math.pow(10, precision)
x = Math.round(x * multiplier) / multiplier
return x | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | f502f5c28dea77e3fdbffdb30718c9508eb4582a | 1,052 | https://github.com/cdglabs/apparatus/blob/f502f5c28dea77e3fdbffdb30718c9508eb4582a/src/Util/Util.coffee | 113 | 116 |
cdglabs/apparatus:src/Util/Util.coffee:13:completion | completion | Util.roundToPrecision = (x, precision) ->
multiplier = Math.pow(10, precision) | x = Math.round(x * multiplier) / multiplier
return x | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | f502f5c28dea77e3fdbffdb30718c9508eb4582a | 1,052 | https://github.com/cdglabs/apparatus/blob/f502f5c28dea77e3fdbffdb30718c9508eb4582a/src/Util/Util.coffee | 113 | 116 |
cdglabs/apparatus:src/Util/Util.coffee:6:raw_corpus | raw_corpus | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return object.id = Util.generateId()
# TODO: Replace with UUID.
counter = 0 | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/Util/Util.coffee | 62 | 67 | ||
cdglabs/apparatus:src/Util/Util.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return object.id = Util.generateId()
# TODO: Replace with UUID.
counter = 0
``` | var counter;
Util.getId = function(object) {
if (object.hasOwnProperty("id")) {
return object.id;
}
return object.id = Util.generateId();
};
// TODO: Replace with UUID.
counter = 0; | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/Util/Util.coffee | 62 | 67 |
cdglabs/apparatus:src/Util/Util.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var counter;
Util.getId = function(object) {
if (object.hasOwnProperty("id")) {
return object.id;
}
return object.id = Util.generateId();
};
// TODO: Replace with UUID.
counter = 0;
``` | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return object.id = Util.generateId()
# TODO: Replace with UUID.
counter = 0 | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/Util/Util.coffee | 62 | 67 |
cdglabs/apparatus:src/Util/Util.coffee:6:completion | completion | Util.getId = (object) ->
return object.id if object.hasOwnProperty("id")
return object.id = Util.generateId() | # TODO: Replace with UUID.
counter = 0 | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/Util/Util.coffee | 62 | 67 |
cdglabs/apparatus:src/Util/Util.coffee:7:raw_corpus | raw_corpus | Util.generateId = ->
counter++
return "id" + counter
# =============================================================================
# Numeric
# ============================================================================= | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/Util/Util.coffee | 68 | 75 | ||
cdglabs/apparatus:src/Util/Util.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.generateId = ->
counter++
return "id" + counter
# =============================================================================
# Numeric
# =============================================================================
``` | Util.generateId = function() {
counter++;
return "id" + counter;
};
// =============================================================================
// Numeric
// ============================================================================= | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/Util/Util.coffee | 68 | 75 |
cdglabs/apparatus:src/Util/Util.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.generateId = function() {
counter++;
return "id" + counter;
};
// =============================================================================
// Numeric
// =============================================================================
``` | Util.generateId = ->
counter++
return "id" + counter
# =============================================================================
# Numeric
# ============================================================================= | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | 93c2cda678de77c5a0cd7663f307bd02353f4fc5 | 1,052 | https://github.com/cdglabs/apparatus/blob/93c2cda678de77c5a0cd7663f307bd02353f4fc5/src/Util/Util.coffee | 68 | 75 |
cdglabs/apparatus:src/Util/Util.coffee:4:raw_corpus | raw_corpus | Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur()
# ===================... | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/Util/Util.coffee | 38 | 51 | ||
cdglabs/apparatus:src/Util/Util.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.... | Util.mouseDownPreventDefault = function(e) {
var el, i, len, ref, results;
e.preventDefault();
document.activeElement.blur();
window.getSelection().removeAllRanges();
document.body.focus();
ref = document.querySelectorAll(".CodeMirror-focused");
// Unfocus any focused Code Mirrors
results = [];
for (i... | CoffeeScript | JavaScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/Util/Util.coffee | 38 | 51 |
cdglabs/apparatus:src/Util/Util.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
Util.mouseDownPreventDefault = function(e) {
var el, i, len, ref, results;
e.preventDefault();
document.activeElement.blur();
window.getSelection().removeAllRanges();
document.body.focus();
ref = document.querySelectorAll(".CodeMirror-focused");
// Un... | Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors
for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur()
# ===================... | JavaScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/Util/Util.coffee | 38 | 51 |
cdglabs/apparatus:src/Util/Util.coffee:4:completion | completion | Util.mouseDownPreventDefault = (e) ->
e.preventDefault()
document.activeElement.blur()
window.getSelection().removeAllRanges()
document.body.focus()
# Unfocus any focused Code Mirrors | for el in document.querySelectorAll(".CodeMirror-focused")
el.CodeMirror.getInputField().blur()
# =============================================================================
# Numeric
# ============================================================================= | CoffeeScript | CoffeeScript | cdglabs/apparatus | src/Util/Util.coffee | MIT | e6bd2b9859b5c223ed589131247a02487b570769 | 1,052 | https://github.com/cdglabs/apparatus/blob/e6bd2b9859b5c223ed589131247a02487b570769/src/Util/Util.coffee | 38 | 51 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:1:raw_corpus | raw_corpus | ###
# Copyright (c) 2016-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/header/directives.headerParameter.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/header/directives.headerParameter.coffee | 1 | 39 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:1:completion | completion | ###
# Copyright (c) 2016-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law ... | scope:
dashboard: '='
parameterDefinition: '='
replace: true
templateUrl: '/widgets/header/headerParameter.html'
controller: ($scope) ->
originalValue = $window.Cyclotron.parameters[$scope.parameterDefinition.name]
$scope.parameter =
... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/header/directives.headerParameter.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/header/directives.headerParameter.coffee | 1 | 39 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:2:raw_corpus | raw_corpus | if $scope.parameterDefinition.editing?.datetimeFormat?
$scope.parameter.datetimeOptions.datetimeFormat = $scope.parameterDefinition.editing.datetimeFormat
else
$scope.parameter.datetimeOptions.datetimeFormat = 'YYYY-MM-DD HH:mm'
when '... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/header/directives.headerParameter.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/header/directives.headerParameter.coffee | 41 | 81 | ||
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:2:completion | completion | if $scope.parameterDefinition.editing?.datetimeFormat?
$scope.parameter.datetimeOptions.datetimeFormat = $scope.parameterDefinition.editing.datetimeFormat
else
$scope.parameter.datetimeOptions.datetimeFormat = 'YYYY-MM-DD HH:mm'
when '... | if $scope.parameterDefinition.editing?.datetimeFormat?
$scope.parameter.datetimeOptions.datetimeFormat = $scope.parameterDefinition.editing.datetimeFormat
else
$scope.parameter.datetimeOptions.datetimeFormat = 'HH:mm'
$scope.selectValue = ... | CoffeeScript | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/header/directives.headerParameter.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/header/directives.headerParameter.coffee | 41 | 81 |
ExpediaGroup/cyclotron:cyclotron-site/app/widgets/header/directives.headerParameter.coffee:3:raw_corpus | raw_corpus | # Data Source (re)loaded
$scope.$on 'dataSource:' + dsDefinition.name + ':data', (event, eventData) ->
return unless eventData.version > $scope.dataVersion
$scope.dataVersion = eventData.version
$scope.dataSourceData = eventData.data[dsDefiniti... | CoffeeScript | ExpediaGroup/cyclotron | cyclotron-site/app/widgets/header/directives.headerParameter.coffee | MIT | 0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab | 1,544 | https://github.com/ExpediaGroup/cyclotron/blob/0228db71d84a3138a9ffddb50d8f4f8ff37cc5ab/cyclotron-site/app/widgets/header/directives.headerParameter.coffee | 83 | 95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.