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:scoring.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
nPk = (n, k) ->
result = 1
result *= m for m in [n-k+1..n]
result
``` | var nPk;
nPk = function(n, k) {
var i, m, ref, ref1, result;
result = 1;
for (m = i = ref = n - k + 1, ref1 = n; (ref <= ref1 ? i <= ref1 : i >= ref1); m = ref <= ref1 ? ++i : --i) {
result *= m;
}
return result;
}; | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 3 | 6 |
dropbox/zxcvbn:scoring.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var nPk;
nPk = function(n, k) {
var i, m, ref, ref1, result;
result = 1;
for (m = i = ref = n - k + 1, ref1 = n; (ref <= ref1 ? i <= ref1 : i >= ref1); m = ref <= ref1 ? ++i : --i) {
result *= m;
}
return result;
};
``` | nPk = (n, k) ->
result = 1
result *= m for m in [n-k+1..n]
result | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 3 | 6 |
dropbox/zxcvbn:scoring.coffee:2:completion | completion | nPk = (n, k) ->
result = 1 | result *= m for m in [n-k+1..n]
result | CoffeeScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 3 | 6 |
dropbox/zxcvbn:scoring.coffee:3:raw_corpus | raw_corpus | nCk = (n, k) ->
k_fact = 1
k_fact *= m for m in [1..k]
nPk(n, k) / k_fact
PRINTABLE_CHARS = 95
ALPHANUM_CHARS = 62
NUM_YEARS = 119 # years match against 1900 - 2019
NUM_MONTHS = 12
NUM_DAYS = 31
KEYBOARD_BRANCHING = 6
KEYBOARD_SIZE = 47
KEYPAD_BRANCHING = 9
KEYPAD_SIZE = 15 | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 8 | 22 | ||
dropbox/zxcvbn:scoring.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
nCk = (n, k) ->
k_fact = 1
k_fact *= m for m in [1..k]
nPk(n, k) / k_fact
PRINTABLE_CHARS = 95
ALPHANUM_CHARS = 62
NUM_YEARS = 119 # years match against 1900 - 2019
NUM_MONTHS = 12
NUM_DAYS = 31
KEYBOARD_BRANCHING = 6
KEYBOARD_SIZE = 47
KEYPAD_BRANCHING =... | var ALPHANUM_CHARS, KEYBOARD_BRANCHING, KEYBOARD_SIZE, KEYPAD_BRANCHING, KEYPAD_SIZE, NUM_DAYS, NUM_MONTHS, NUM_YEARS, PRINTABLE_CHARS, nCk;
nCk = function(n, k) {
var i, k_fact, m, ref;
k_fact = 1;
for (m = i = 1, ref = k; (1 <= ref ? i <= ref : i >= ref); m = 1 <= ref ? ++i : --i) {
k_fact *= m;
}
retu... | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 8 | 22 |
dropbox/zxcvbn:scoring.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ALPHANUM_CHARS, KEYBOARD_BRANCHING, KEYBOARD_SIZE, KEYPAD_BRANCHING, KEYPAD_SIZE, NUM_DAYS, NUM_MONTHS, NUM_YEARS, PRINTABLE_CHARS, nCk;
nCk = function(n, k) {
var i, k_fact, m, ref;
k_fact = 1;
for (m = i = 1, ref = k; (1 <= ref ? i <= ref : i >= ref); ... | nCk = (n, k) ->
k_fact = 1
k_fact *= m for m in [1..k]
nPk(n, k) / k_fact
PRINTABLE_CHARS = 95
ALPHANUM_CHARS = 62
NUM_YEARS = 119 # years match against 1900 - 2019
NUM_MONTHS = 12
NUM_DAYS = 31
KEYBOARD_BRANCHING = 6
KEYBOARD_SIZE = 47
KEYPAD_BRANCHING = 9
KEYPAD_SIZE = 15 | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 8 | 22 |
dropbox/zxcvbn:scoring.coffee:3:completion | completion | nCk = (n, k) ->
k_fact = 1
k_fact *= m for m in [1..k]
nPk(n, k) / k_fact
PRINTABLE_CHARS = 95
ALPHANUM_CHARS = 62 | NUM_YEARS = 119 # years match against 1900 - 2019
NUM_MONTHS = 12
NUM_DAYS = 31
KEYBOARD_BRANCHING = 6
KEYBOARD_SIZE = 47
KEYPAD_BRANCHING = 9
KEYPAD_SIZE = 15 | CoffeeScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 8 | 22 |
dropbox/zxcvbn:scoring.coffee:4:raw_corpus | raw_corpus | calc_entropy = (match) ->
switch match.pattern
when 'repeat' then repeat_entropy match
when 'sequence' then sequence_entropy match
when 'digits' then digits_entropy match
when 'year' then year_entropy match
when 'date' then date_entropy match
when 's... | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 24 | 33 | ||
dropbox/zxcvbn:scoring.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
calc_entropy = (match) ->
switch match.pattern
when 'repeat' then repeat_entropy match
when 'sequence' then sequence_entropy match
when 'digits' then digits_entropy match
when 'year' then year_entropy match
wh... | var calc_entropy;
calc_entropy = function(match) {
switch (match.pattern) {
case 'repeat':
return repeat_entropy(match);
case 'sequence':
return sequence_entropy(match);
case 'digits':
return digits_entropy(match);
case 'year':
return year_entropy(match);
case 'date':
... | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 24 | 33 |
dropbox/zxcvbn:scoring.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var calc_entropy;
calc_entropy = function(match) {
switch (match.pattern) {
case 'repeat':
return repeat_entropy(match);
case 'sequence':
return sequence_entropy(match);
case 'digits':
return digits_entropy(match);
case 'year':
... | calc_entropy = (match) ->
switch match.pattern
when 'repeat' then repeat_entropy match
when 'sequence' then sequence_entropy match
when 'digits' then digits_entropy match
when 'year' then year_entropy match
when 'date' then date_entropy match
when 's... | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 24 | 33 |
dropbox/zxcvbn:scoring.coffee:6:raw_corpus | raw_corpus | sequence_entropy = (match) ->
first_chr = match.token[0]
if first_chr in ['a' or '1']
base_entropy = 1
else
if first_chr.match /\d/
base_entropy = log2(10) # digits
else if first_chr.match /[a-z]/
base_entropy = log2(26) # lower
else
base_entropy = log2(26) + 1 # extra bit for up... | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 37 | 50 | ||
dropbox/zxcvbn:scoring.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
sequence_entropy = (match) ->
first_chr = match.token[0]
if first_chr in ['a' or '1']
base_entropy = 1
else
if first_chr.match /\d/
base_entropy = log2(10) # digits
else if first_chr.match /[a-z]/
base_entropy = log2(26) # lower
... | var sequence_entropy;
sequence_entropy = function(match) {
var base_entropy, first_chr;
first_chr = match.token[0];
if (first_chr === ('a' || '1')) {
base_entropy = 1;
} else {
if (first_chr.match(/\d/)) {
base_entropy = log2(10); // digits
} else if (first_chr.match(/[a-z]/)) {
base_en... | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 37 | 50 |
dropbox/zxcvbn:scoring.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var sequence_entropy;
sequence_entropy = function(match) {
var base_entropy, first_chr;
first_chr = match.token[0];
if (first_chr === ('a' || '1')) {
base_entropy = 1;
} else {
if (first_chr.match(/\d/)) {
base_entropy = log2(10); // digits
... | sequence_entropy = (match) ->
first_chr = match.token[0]
if first_chr in ['a' or '1']
base_entropy = 1
else
if first_chr.match /\d/
base_entropy = log2(10) # digits
else if first_chr.match /[a-z]/
base_entropy = log2(26) # lower
else
base_entropy = log2(26) + 1 # extra bit for up... | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 37 | 50 |
dropbox/zxcvbn:scoring.coffee:6:completion | completion | sequence_entropy = (match) ->
first_chr = match.token[0]
if first_chr in ['a' or '1']
base_entropy = 1
else
if first_chr.match /\d/
base_entropy = log2(10) # digits | else if first_chr.match /[a-z]/
base_entropy = log2(26) # lower
else
base_entropy = log2(26) + 1 # extra bit for uppercase
if not match.ascending
base_entropy += 1 # extra bit for descending instead of ascending
base_entropy + log2 match.token.length | CoffeeScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 37 | 50 |
dropbox/zxcvbn:scoring.coffee:9:raw_corpus | raw_corpus | date_entropy = (match) ->
if match.year < 100
entropy = log2(NUM_DAYS * NUM_MONTHS * 100) # two-digit year
else
entropy = log2(NUM_DAYS * NUM_MONTHS * NUM_YEARS) # four-digit year
if match.separator
entropy += 2 # add two bits for separator selection [/,-,.,etc]
entropy | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 56 | 63 | ||
dropbox/zxcvbn:scoring.coffee:9:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
date_entropy = (match) ->
if match.year < 100
entropy = log2(NUM_DAYS * NUM_MONTHS * 100) # two-digit year
else
entropy = log2(NUM_DAYS * NUM_MONTHS * NUM_YEARS) # four-digit year
if match.separator
entropy += 2 # add two bits for separator sele... | var date_entropy;
date_entropy = function(match) {
var entropy;
if (match.year < 100) {
entropy = log2(NUM_DAYS * NUM_MONTHS * 100); // two-digit year
} else {
entropy = log2(NUM_DAYS * NUM_MONTHS * NUM_YEARS); // four-digit year
}
if (match.separator) {
entropy += 2; // add two bits for separato... | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 56 | 63 |
dropbox/zxcvbn:scoring.coffee:9:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var date_entropy;
date_entropy = function(match) {
var entropy;
if (match.year < 100) {
entropy = log2(NUM_DAYS * NUM_MONTHS * 100); // two-digit year
} else {
entropy = log2(NUM_DAYS * NUM_MONTHS * NUM_YEARS); // four-digit year
}
if (match.sepa... | date_entropy = (match) ->
if match.year < 100
entropy = log2(NUM_DAYS * NUM_MONTHS * 100) # two-digit year
else
entropy = log2(NUM_DAYS * NUM_MONTHS * NUM_YEARS) # four-digit year
if match.separator
entropy += 2 # add two bits for separator selection [/,-,.,etc]
entropy | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 56 | 63 |
dropbox/zxcvbn:scoring.coffee:9:completion | completion | date_entropy = (match) ->
if match.year < 100
entropy = log2(NUM_DAYS * NUM_MONTHS * 100) # two-digit year
else | entropy = log2(NUM_DAYS * NUM_MONTHS * NUM_YEARS) # four-digit year
if match.separator
entropy += 2 # add two bits for separator selection [/,-,.,etc]
entropy | CoffeeScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 56 | 63 |
dropbox/zxcvbn:scoring.coffee:10:raw_corpus | raw_corpus | spatial_entropy = (match) ->
if match.graph in ['qwerty', 'dvorak']
start_choices = KEYBOARD_SIZE
branching = KEYBOARD_BRANCHING
else
start_choices = KEYPAD_SIZE
branching = KEYPAD_BRANCHING
entropy = log2(start_choices * match.token.length)
if match.turns > 0
possible_turn_points = match.to... | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 65 | 77 | ||
dropbox/zxcvbn:scoring.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
spatial_entropy = (match) ->
if match.graph in ['qwerty', 'dvorak']
start_choices = KEYBOARD_SIZE
branching = KEYBOARD_BRANCHING
else
start_choices = KEYPAD_SIZE
branching = KEYPAD_BRANCHING
entropy = log2(start_choices * match.token.length)... | var spatial_entropy;
spatial_entropy = function(match) {
var branching, entropy, possible_turn_points, possible_turn_seqs, ref, start_choices;
if ((ref = match.graph) === 'qwerty' || ref === 'dvorak') {
start_choices = KEYBOARD_SIZE;
branching = KEYBOARD_BRANCHING;
} else {
start_choices = KEYPAD_SIZ... | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 65 | 77 |
dropbox/zxcvbn:scoring.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var spatial_entropy;
spatial_entropy = function(match) {
var branching, entropy, possible_turn_points, possible_turn_seqs, ref, start_choices;
if ((ref = match.graph) === 'qwerty' || ref === 'dvorak') {
start_choices = KEYBOARD_SIZE;
branching = KEYBOA... | spatial_entropy = (match) ->
if match.graph in ['qwerty', 'dvorak']
start_choices = KEYBOARD_SIZE
branching = KEYBOARD_BRANCHING
else
start_choices = KEYPAD_SIZE
branching = KEYPAD_BRANCHING
entropy = log2(start_choices * match.token.length)
if match.turns > 0
possible_turn_points = match.to... | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 65 | 77 |
dropbox/zxcvbn:scoring.coffee:10:completion | completion | spatial_entropy = (match) ->
if match.graph in ['qwerty', 'dvorak']
start_choices = KEYBOARD_SIZE
branching = KEYBOARD_BRANCHING
else
start_choices = KEYPAD_SIZE | branching = KEYPAD_BRANCHING
entropy = log2(start_choices * match.token.length)
if match.turns > 0
possible_turn_points = match.token.length - 1
possible_turn_seqs = nCk(possible_turn_points, match.turns)
entropy += log2(branching * possible_turn_seqs)
entropy | CoffeeScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 65 | 77 |
dropbox/zxcvbn:scoring.coffee:11:raw_corpus | raw_corpus | dictionary_entropy = (match) ->
entropy = log2 match.rank
if match.token.match /^[A-Z][^A-Z]+$/
entropy += 1 # capitalized word is most common capitalization scheme
else if match.token.match /^[^A-Z]+[A-Z]$/
entropy += 2 # then end-capitalized
else if match.token.match /^[^a-z]+$/
entropy += 2 # or ... | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 79 | 99 | ||
dropbox/zxcvbn:scoring.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
dictionary_entropy = (match) ->
entropy = log2 match.rank
if match.token.match /^[A-Z][^A-Z]+$/
entropy += 1 # capitalized word is most common capitalization scheme
else if match.token.match /^[^A-Z]+[A-Z]$/
entropy += 2 # then end-capitalized
els... | var dictionary_entropy,
indexOf = [].indexOf;
dictionary_entropy = function(match) {
var chr, entropy, h4x_chrs, k, num_alpha, num_h4x, num_possibles, num_upper, sub_chrs, v;
entropy = log2(match.rank);
if (match.token.match(/^[A-Z][^A-Z]+$/)) {
entropy += 1; // capitalized word is most common capitalizati... | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 79 | 99 |
dropbox/zxcvbn:scoring.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var dictionary_entropy,
indexOf = [].indexOf;
dictionary_entropy = function(match) {
var chr, entropy, h4x_chrs, k, num_alpha, num_h4x, num_possibles, num_upper, sub_chrs, v;
entropy = log2(match.rank);
if (match.token.match(/^[A-Z][^A-Z]+$/)) {
entrop... | dictionary_entropy = (match) ->
entropy = log2 match.rank
if match.token.match /^[A-Z][^A-Z]+$/
entropy += 1 # capitalized word is most common capitalization scheme
else if match.token.match /^[^A-Z]+[A-Z]$/
entropy += 2 # then end-capitalized
else if match.token.match /^[^a-z]+$/
entropy += 2 # or ... | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 79 | 99 |
dropbox/zxcvbn:scoring.coffee:11:completion | completion | dictionary_entropy = (match) ->
entropy = log2 match.rank
if match.token.match /^[A-Z][^A-Z]+$/
entropy += 1 # capitalized word is most common capitalization scheme
else if match.token.match /^[^A-Z]+[A-Z]$/
entropy += 2 # then end-capitalized
else if match.token.match /^[^a-z]+$/
entropy += 2 # or ... | else if not match.token.match /^[^A-Z]+$/
num_alpha = (chr for chr in match.token when chr.match /[A-Za-z]/).length
num_upper = (chr for chr in match.token when chr.match /[A-Z]/).length
entropy += log2 nCk(num_alpha, num_upper)
if match.h4x0rd
sub_chrs = (v for k,v of match.sub)
h4x_chrs = (k for... | CoffeeScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 79 | 99 |
dropbox/zxcvbn:scoring.coffee:12:raw_corpus | raw_corpus | bruteforce_entropy = (match) ->
log2 Math.pow(match.cardinality, match.token.length)
for match in bruteforce_match 'lKajsf2-2-198877'
console.log match, calc_entropy(match) | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 101 | 105 | ||
dropbox/zxcvbn:scoring.coffee:12:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
bruteforce_entropy = (match) ->
log2 Math.pow(match.cardinality, match.token.length)
for match in bruteforce_match 'lKajsf2-2-198877'
console.log match, calc_entropy(match)
``` | var bruteforce_entropy, i, len, match, ref;
bruteforce_entropy = function(match) {
return log2(Math.pow(match.cardinality, match.token.length));
};
ref = bruteforce_match('lKajsf2-2-198877');
for (i = 0, len = ref.length; i < len; i++) {
match = ref[i];
console.log(match, calc_entropy(match));
} | CoffeeScript | JavaScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 101 | 105 |
dropbox/zxcvbn:scoring.coffee:12:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var bruteforce_entropy, i, len, match, ref;
bruteforce_entropy = function(match) {
return log2(Math.pow(match.cardinality, match.token.length));
};
ref = bruteforce_match('lKajsf2-2-198877');
for (i = 0, len = ref.length; i < len; i++) {
match = ref[i];
con... | bruteforce_entropy = (match) ->
log2 Math.pow(match.cardinality, match.token.length)
for match in bruteforce_match 'lKajsf2-2-198877'
console.log match, calc_entropy(match) | JavaScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 101 | 105 |
dropbox/zxcvbn:scoring.coffee:12:completion | completion | bruteforce_entropy = (match) ->
log2 Math.pow(match.cardinality, match.token.length) | for match in bruteforce_match 'lKajsf2-2-198877'
console.log match, calc_entropy(match) | CoffeeScript | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 101 | 105 |
oozcitak/xmlbuilder-js:test/basic/removeitem.coffee:1:raw_corpus | raw_corpus | suite 'Editing:', ->
test 'Remove item', ->
eq(
xml('test3', {}, {}, { headless: true })
.e('node', 'first instance')
.u()
.e('node', 'second instance')
.remove()
.e('node', 'third instance')
.end()
'<test3><node>first instance</node><node>third instance... | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/removeitem.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/removeitem.coffee | 1 | 12 | ||
oozcitak/xmlbuilder-js:test/basic/removeitem.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Editing:', ->
test 'Remove item', ->
eq(
xml('test3', {}, {}, { headless: true })
.e('node', 'first instance')
.u()
.e('node', 'second instance')
.remove()
.e('node', 'third instance')
.end()
... | suite('Editing:', function() {
return test('Remove item', function() {
return eq(xml('test3', {}, {}, {
headless: true
}).e('node', 'first instance').u().e('node', 'second instance').remove().e('node', 'third instance').end(), '<test3><node>first instance</node><node>third instance</node></test3>');
}... | CoffeeScript | JavaScript | oozcitak/xmlbuilder-js | test/basic/removeitem.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/removeitem.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/removeitem.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
suite('Editing:', function() {
return test('Remove item', function() {
return eq(xml('test3', {}, {}, {
headless: true
}).e('node', 'first instance').u().e('node', 'second instance').remove().e('node', 'third instance').end(), '<test3><node>first in... | suite 'Editing:', ->
test 'Remove item', ->
eq(
xml('test3', {}, {}, { headless: true })
.e('node', 'first instance')
.u()
.e('node', 'second instance')
.remove()
.e('node', 'third instance')
.end()
'<test3><node>first instance</node><node>third instance... | JavaScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/removeitem.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/removeitem.coffee | 1 | 12 |
oozcitak/xmlbuilder-js:test/basic/removeitem.coffee:1:completion | completion | suite 'Editing:', ->
test 'Remove item', ->
eq(
xml('test3', {}, {}, { headless: true })
.e('node', 'first instance')
.u() | .e('node', 'second instance')
.remove()
.e('node', 'third instance')
.end()
'<test3><node>first instance</node><node>third instance</node></test3>'
) | CoffeeScript | CoffeeScript | oozcitak/xmlbuilder-js | test/basic/removeitem.coffee | MIT | ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1 | 926 | https://github.com/oozcitak/xmlbuilder-js/blob/ce625aeb9f52d1f75d5d94260794d3b5fd74a8b1/test/basic/removeitem.coffee | 1 | 12 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description: 'description'
placeholder: 'placeholder'
... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027 | 600 | https://github.com/kelp404/angular-form-builder/blob/6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027/components/default-components.coffee | 3 | 52 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
descript... | var config;
config = function($builderProvider) {
// ----------------------------------------
// text input
// ----------------------------------------
return $builderProvider.registerComponent('textInput', {
group: 'Default',
label: 'Text Input',
description: 'description',
placeholder: 'place... | CoffeeScript | JavaScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027 | 600 | https://github.com/kelp404/angular-form-builder/blob/6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027/components/default-components.coffee | 3 | 52 |
kelp404/angular-form-builder:components/default-components.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var config;
config = function($builderProvider) {
// ----------------------------------------
// text input
// ----------------------------------------
return $builderProvider.registerComponent('textInput', {
group: 'Default',
label: 'Text Input',
... | config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description: 'description'
placeholder: 'placeholder'
... | JavaScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027 | 600 | https://github.com/kelp404/angular-form-builder/blob/6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027/components/default-components.coffee | 3 | 52 |
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description: 'description'
placeholder: 'placeholder'
... | <label class='control-label'>Label</label>
<input type='text' ng-model="label" validator="[required]" class='form-control'/>
</div>
<div class="form-group">
<label class='control-label'>Description</label>
<input type='text' ng-... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027 | 600 | https://github.com/kelp404/angular-form-builder/blob/6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027/components/default-components.coffee | 3 | 52 |
kelp404/angular-form-builder:components/default-components.coffee:3:raw_corpus | raw_corpus | <input type='button' ng-click="popover.remove($event)" class='btn btn-danger' value='Delete'/>
</div>
</form>
"""
# ----------------------------------------
# select
# ----------------------------------------
$builderProvider.registerComponent 'select',
g... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027 | 600 | https://github.com/kelp404/angular-form-builder/blob/6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027/components/default-components.coffee | 103 | 152 | ||
kelp404/angular-form-builder:components/default-components.coffee:3:completion | completion | <input type='button' ng-click="popover.remove($event)" class='btn btn-danger' value='Delete'/>
</div>
</form>
"""
# ----------------------------------------
# select
# ----------------------------------------
$builderProvider.registerComponent 'select',
g... | popoverTemplate:
"""
<form>
<div class="form-group">
<label class='control-label'>Label</label>
<input type='text' ng-model="label" validator="[required]" class='form-control'/>
</div>
<div class="form-group"... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027 | 600 | https://github.com/kelp404/angular-form-builder/blob/6ef45bd840e4e6d70dfea9d2e7ec7ab0a63f3027/components/default-components.coffee | 103 | 152 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description: 'description'
placeholder: 'placeholder'
... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 3 | 52 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
descript... | var config;
config = function($builderProvider) {
// ----------------------------------------
// text input
// ----------------------------------------
return $builderProvider.registerComponent('textInput', {
group: 'Default',
label: 'Text Input',
description: 'description',
placeholder: 'place... | CoffeeScript | JavaScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 3 | 52 |
kelp404/angular-form-builder:components/default-components.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var config;
config = function($builderProvider) {
// ----------------------------------------
// text input
// ----------------------------------------
return $builderProvider.registerComponent('textInput', {
group: 'Default',
label: 'Text Input',
... | config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description: 'description'
placeholder: 'placeholder'
... | JavaScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 3 | 52 |
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | config = ($builderProvider) ->
# ----------------------------------------
# text input
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description: 'description'
placeholder: 'placeholder'
... | <label class='control-label'>Label</label>
<input type='text' ng-model="label" validator="[required]" class='form-control'/>
</div>
<div class="form-group">
<label class='control-label'>Description</label>
<input type='text' ng-... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 3 | 52 |
kelp404/angular-form-builder:components/default-components.coffee:2:raw_corpus | raw_corpus | # ----------------------------------------
# select
# ----------------------------------------
$builderProvider.registerComponent 'select',
group: 'Default'
label: 'Select'
description: 'description'
placeholder: 'placeholder'
required: no
options: ['value one... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 53 | 102 | ||
kelp404/angular-form-builder:components/default-components.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# ----------------------------------------
# select
# ----------------------------------------
$builderProvider.registerComponent 'select',
group: 'Default'
label: 'Select'
description: 'description'
placeholder: 'place... | // ----------------------------------------
// select
// ----------------------------------------
$builderProvider.registerComponent('select', {
group: 'Default',
label: 'Select',
description: 'description',
placeholder: 'placeholder',
required: false,
options: ['value one', 'value two'],
template: `<div ... | CoffeeScript | JavaScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 53 | 102 |
kelp404/angular-form-builder:components/default-components.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// ----------------------------------------
// select
// ----------------------------------------
$builderProvider.registerComponent('select', {
group: 'Default',
label: 'Select',
description: 'description',
placeholder: 'placeholder',
required: false,
... | # ----------------------------------------
# select
# ----------------------------------------
$builderProvider.registerComponent 'select',
group: 'Default'
label: 'Select'
description: 'description'
placeholder: 'placeholder'
required: no
options: ['value one... | JavaScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 53 | 102 |
kelp404/angular-form-builder:components/default-components.coffee:2:completion | completion | # ----------------------------------------
# select
# ----------------------------------------
$builderProvider.registerComponent 'select',
group: 'Default'
label: 'Select'
description: 'description'
placeholder: 'placeholder'
required: no
options: ['value one... | <label class='control-label'>Label</label>
<input type='text' ng-model="label" validator="[required]" class='form-control'/>
</div>
<div class="form-group">
<label class='control-label'>Description</label>
<input type='text' ng-... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 620a584cae3a1e9970ca8dc4ee8a47123e91833e | 600 | https://github.com/kelp404/angular-form-builder/blob/620a584cae3a1e9970ca8dc4ee8a47123e91833e/components/default-components.coffee | 53 | 102 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 29b1e56f69d7776f8efe0d80b44ca498fed4b851 | 600 | https://github.com/kelp404/angular-form-builder/blob/29b1e56f69d7776f8efe0d80b44ca498fed4b851/components/default-components.coffee | 1 | 50 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | <div class="form-group">
<label class='control-label'>Label</label>
<input type='text' ng-model="label" validator="[required]" class='form-control'/>
</div>
<div class="form-group">
<label class='control-label'>Description</labe... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 29b1e56f69d7776f8efe0d80b44ca498fed4b851 | 600 | https://github.com/kelp404/angular-form-builder/blob/29b1e56f69d7776f8efe0d80b44ca498fed4b851/components/default-components.coffee | 1 | 50 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | f673d1e0f16fc507e96211cea3e26593cf714715 | 600 | https://github.com/kelp404/angular-form-builder/blob/f673d1e0f16fc507e96211cea3e26593cf714715/components/default-components.coffee | 1 | 50 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | <div class="form-group">
<label class='control-label col-md-10'>Label</label>
<div class="col-md-10">
<input type='text' ng-model="label" validator="[required]" class='form-control'/>
</div>
</div>
<div c... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | f673d1e0f16fc507e96211cea3e26593cf714715 | 600 | https://github.com/kelp404/angular-form-builder/blob/f673d1e0f16fc507e96211cea3e26593cf714715/components/default-components.coffee | 1 | 50 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | ac779b10560009d241b0fe2bebf34beda62c0b4e | 600 | https://github.com/kelp404/angular-form-builder/blob/ac779b10560009d241b0fe2bebf34beda62c0b4e/components/default-components.coffee | 1 | 50 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | <div class="form-group">
<label class='control-label col-md-10'>Label</label>
<div class="col-md-10">
<input type='text' ng-model="label" class='form-control'/>
</div>
</div>
<div class="form-group">
... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | ac779b10560009d241b0fe2bebf34beda62c0b4e | 600 | https://github.com/kelp404/angular-form-builder/blob/ac779b10560009d241b0fe2bebf34beda62c0b4e/components/default-components.coffee | 1 | 50 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 3445dfb9abba7d7ec259aee7a427935ac011c5b2 | 600 | https://github.com/kelp404/angular-form-builder/blob/3445dfb9abba7d7ec259aee7a427935ac011c5b2/components/default-components.coffee | 1 | 25 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: '... | var a, config;
a = angular.module('builder.components', ['builder']);
config = function($builderProvider) {
// ----------------------------------------
// textInput
// ----------------------------------------
return $builderProvider.registerComponent('textInput', {
group: 'Default',
label: 'Text Input... | CoffeeScript | JavaScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 3445dfb9abba7d7ec259aee7a427935ac011c5b2 | 600 | https://github.com/kelp404/angular-form-builder/blob/3445dfb9abba7d7ec259aee7a427935ac011c5b2/components/default-components.coffee | 1 | 25 |
kelp404/angular-form-builder:components/default-components.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var a, config;
a = angular.module('builder.components', ['builder']);
config = function($builderProvider) {
// ----------------------------------------
// textInput
// ----------------------------------------
return $builderProvider.registerComponent('tex... | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | JavaScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 3445dfb9abba7d7ec259aee7a427935ac011c5b2 | 600 | https://github.com/kelp404/angular-form-builder/blob/3445dfb9abba7d7ec259aee7a427935ac011c5b2/components/default-components.coffee | 1 | 25 |
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | template:
"""
<div class="form-group">
<label for="{{name+label}}" class="col-md-4 control-label">{{label}}</label>
<div class="col-md-8">
<input type="text" id="{{name+label}}" class="form-control" placeholder="{{placeholder}}"/>
... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 3445dfb9abba7d7ec259aee7a427935ac011c5b2 | 600 | https://github.com/kelp404/angular-form-builder/blob/3445dfb9abba7d7ec259aee7a427935ac011c5b2/components/default-components.coffee | 1 | 25 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 805a5738c1f1eea587e75837bdc935a50517ad25 | 600 | https://github.com/kelp404/angular-form-builder/blob/805a5738c1f1eea587e75837bdc935a50517ad25/components/default-components.coffee | 1 | 24 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: '... | var a, config;
a = angular.module('builder.components', ['builder']);
config = function($builderProvider) {
// ----------------------------------------
// textInput
// ----------------------------------------
return $builderProvider.registerComponent('textInput', {
group: 'Default',
label: 'Text Input... | CoffeeScript | JavaScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 805a5738c1f1eea587e75837bdc935a50517ad25 | 600 | https://github.com/kelp404/angular-form-builder/blob/805a5738c1f1eea587e75837bdc935a50517ad25/components/default-components.coffee | 1 | 24 |
kelp404/angular-form-builder:components/default-components.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var a, config;
a = angular.module('builder.components', ['builder']);
config = function($builderProvider) {
// ----------------------------------------
// textInput
// ----------------------------------------
return $builderProvider.registerComponent('tex... | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | JavaScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 805a5738c1f1eea587e75837bdc935a50517ad25 | 600 | https://github.com/kelp404/angular-form-builder/blob/805a5738c1f1eea587e75837bdc935a50517ad25/components/default-components.coffee | 1 | 24 |
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
group: 'Default'
label: 'Text Input'
description:... | template:
"""
<div class="form-group">
<label for="{{name+label}}" ng-bind="label" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input type="text" validator="{{validation}}" id="{{name+label}}" class="form-control" placeholde... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 805a5738c1f1eea587e75837bdc935a50517ad25 | 600 | https://github.com/kelp404/angular-form-builder/blob/805a5738c1f1eea587e75837bdc935a50517ad25/components/default-components.coffee | 1 | 24 |
kelp404/angular-form-builder:components/default-components.coffee:1:raw_corpus | raw_corpus | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
label: 'Text Input'
description: 'description'
pl... | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 8ee97686f7ad489e9c32611dea765b5b642655b3 | 600 | https://github.com/kelp404/angular-form-builder/blob/8ee97686f7ad489e9c32611dea765b5b642655b3/components/default-components.coffee | 1 | 23 | ||
kelp404/angular-form-builder:components/default-components.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
label: '... | var a, config;
a = angular.module('builder.components', ['builder']);
config = function($builderProvider) {
// ----------------------------------------
// textInput
// ----------------------------------------
return $builderProvider.registerComponent('textInput', {
label: 'Text Input',
description: 'd... | CoffeeScript | JavaScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 8ee97686f7ad489e9c32611dea765b5b642655b3 | 600 | https://github.com/kelp404/angular-form-builder/blob/8ee97686f7ad489e9c32611dea765b5b642655b3/components/default-components.coffee | 1 | 23 |
kelp404/angular-form-builder:components/default-components.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var a, config;
a = angular.module('builder.components', ['builder']);
config = function($builderProvider) {
// ----------------------------------------
// textInput
// ----------------------------------------
return $builderProvider.registerComponent('tex... | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
label: 'Text Input'
description: 'description'
pl... | JavaScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 8ee97686f7ad489e9c32611dea765b5b642655b3 | 600 | https://github.com/kelp404/angular-form-builder/blob/8ee97686f7ad489e9c32611dea765b5b642655b3/components/default-components.coffee | 1 | 23 |
kelp404/angular-form-builder:components/default-components.coffee:1:completion | completion | a = angular.module 'builder.components', ['builder']
config = ($builderProvider) ->
# ----------------------------------------
# textInput
# ----------------------------------------
$builderProvider.registerComponent 'textInput',
label: 'Text Input'
description: 'description'
pl... | template:
"""
<div class="form-group">
<label for="{{name}}" ng-bind="label" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input type="text" validator="{{validation}}" id="{{name}}" class="form-control" placeholder="{{placeho... | CoffeeScript | CoffeeScript | kelp404/angular-form-builder | components/default-components.coffee | MIT | 8ee97686f7ad489e9c32611dea765b5b642655b3 | 600 | https://github.com/kelp404/angular-form-builder/blob/8ee97686f7ad489e9c32611dea765b5b642655b3/components/default-components.coffee | 1 | 23 |
soyjavi/QuoJS:spec/2_css.coffee:1:raw_corpus | raw_corpus | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "q... | CoffeeScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | 86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880 | 2,055 | https://github.com/soyjavi/QuoJS/blob/86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880/spec/2_css.coffee | 1 | 47 | ||
soyjavi/QuoJS:spec/2_css.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "r... | describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("add class to a given element", function() {
el.addClass("new");
return expect(el.hasClass("new")).toBeTruthy();
});
it... | CoffeeScript | JavaScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | 86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880 | 2,055 | https://github.com/soyjavi/QuoJS/blob/86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880/spec/2_css.coffee | 1 | 47 |
soyjavi/QuoJS:spec/2_css.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("add class to a given element", function() {
el.addClass("new");
ret... | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "q... | JavaScript | CoffeeScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | 86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880 | 2,055 | https://github.com/soyjavi/QuoJS/blob/86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880/spec/2_css.coffee | 1 | 47 |
soyjavi/QuoJS:spec/2_css.coffee:1:completion | completion | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "q... | it "test if class exists in a given element", ->
expect(el.hasClass("quo")).toBeTruthy()
it "returns a list of class styles", ->
classList = '0': 'quo', length: 1
expect(el.listClass()["0"]).toEqual classList["0"]
it "set a stylesheet property in a given element", ->
color = "blue"
el.style ... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | 86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880 | 2,055 | https://github.com/soyjavi/QuoJS/blob/86c2d4406262c5ec7c1ec8d3dea8d1d4adbc9880/spec/2_css.coffee | 1 | 47 |
soyjavi/QuoJS:spec/2_css.coffee:1:raw_corpus | raw_corpus | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "q... | CoffeeScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | f3ed40727f537f38953fe5d753063e372641497f | 2,055 | https://github.com/soyjavi/QuoJS/blob/f3ed40727f537f38953fe5d753063e372641497f/spec/2_css.coffee | 1 | 32 | ||
soyjavi/QuoJS:spec/2_css.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "r... | describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("add class to a given element", function() {
el.addClass("new");
return expect(el.hasClass("new")).toBeTruthy();
});
it... | CoffeeScript | JavaScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | f3ed40727f537f38953fe5d753063e372641497f | 2,055 | https://github.com/soyjavi/QuoJS/blob/f3ed40727f537f38953fe5d753063e372641497f/spec/2_css.coffee | 1 | 32 |
soyjavi/QuoJS:spec/2_css.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe("Style", function() {
var el;
el = void 0;
beforeEach(function() {
document.body.innerHTML = `<section class="quo"></section>`;
return el = $$("section");
});
it("add class to a given element", function() {
el.addClass("new");
ret... | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "q... | JavaScript | CoffeeScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | f3ed40727f537f38953fe5d753063e372641497f | 2,055 | https://github.com/soyjavi/QuoJS/blob/f3ed40727f537f38953fe5d753063e372641497f/spec/2_css.coffee | 1 | 32 |
soyjavi/QuoJS:spec/2_css.coffee:1:completion | completion | describe "Style", ->
el = undefined
beforeEach ->
document.body.innerHTML = """<section class="quo"></section>"""
el = $$ "section"
it "add class to a given element", ->
el.addClass "new"
expect(el.hasClass("new")).toBeTruthy()
it "remove class to a given element", ->
el.removeClass "q... | expect(el.hasClass("quo")).not.toBeTruthy()
it "toggle class to a given element", ->
expect(el.hasClass("quo")).toBeTruthy()
el.toggleClass "quo"
expect(el.hasClass("quo")).not.toBeTruthy()
it "test if class exists in a given element", ->
expect(el.hasClass("quo")).toBeTruthy()
it "returns a... | CoffeeScript | CoffeeScript | soyjavi/QuoJS | spec/2_css.coffee | MIT | f3ed40727f537f38953fe5d753063e372641497f | 2,055 | https://github.com/soyjavi/QuoJS/blob/f3ed40727f537f38953fe5d753063e372641497f/spec/2_css.coffee | 1 | 32 |
kahmali/meteor-restivus:test/api_tests.coffee:1:raw_corpus | raw_corpus | if Meteor.isServer
Meteor.startup ->
describe 'An API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.config.useAuth
test.isFalse Restivus.config.prettyJson
... | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 1 | 41 | ||
kahmali/meteor-restivus:test/api_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if Meteor.isServer
Meteor.startup ->
describe 'An API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.config.use... | if (Meteor.isServer) {
Meteor.startup(function() {
return describe('An API', function() {
return context('that hasn\'t been configured', function() {
it('should have default settings', function(test) {
test.equal(Restivus.config.apiPath, 'api/');
test.isFalse(Restivus.config.useA... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 1 | 41 |
kahmali/meteor-restivus:test/api_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (Meteor.isServer) {
Meteor.startup(function() {
return describe('An API', function() {
return context('that hasn\'t been configured', function() {
it('should have default settings', function(test) {
test.equal(Restivus.config.apiPat... | if Meteor.isServer
Meteor.startup ->
describe 'An API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.config.useAuth
test.isFalse Restivus.config.prettyJson
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 1 | 41 |
kahmali/meteor-restivus:test/api_tests.coffee:1:completion | completion | if Meteor.isServer
Meteor.startup ->
describe 'An API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.config.useAuth
test.isFalse Restivus.config.prettyJson
... | test.equal route.options.roleRequired, 'admin'
test.isUndefined route.endpoints.get.authRequired
test.isUndefined route.endpoints.get.roleRequired
it 'should allow you to add an unconfigured collection route', (test) ->
Restivus.addCollection new Mongo.Collection('tests'),
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 1 | 41 |
kahmali/meteor-restivus:test/api_tests.coffee:2:raw_corpus | raw_corpus | it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'api/v1/'
test.equal config.useAuth, true
test.equal config.auth.toke... | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 43 | 83 | ||
kahmali/meteor-restivus:test/api_tests.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'api/v1/'
test.equal c... | it('should be configurable', function(test) {
var config;
Restivus.configure({
apiPath: 'api/v1',
useAuth: true,
auth: {
token: 'apiKey'
}
});
config = Restivus.config;
test.equal(config.apiPath, 'api/v1/');
test.equal(config.useAuth, true);
return test.equal(config.auth.token, 'apiK... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 43 | 83 |
kahmali/meteor-restivus:test/api_tests.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should be configurable', function(test) {
var config;
Restivus.configure({
apiPath: 'api/v1',
useAuth: true,
auth: {
token: 'apiKey'
}
});
config = Restivus.config;
test.equal(config.apiPath, 'api/v1/');
test.equal(config.useAu... | it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'api/v1/'
test.equal config.useAuth, true
test.equal config.auth.toke... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 43 | 83 |
kahmali/meteor-restivus:test/api_tests.coffee:2:completion | completion | it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'api/v1/'
test.equal config.useAuth, true
test.equal config.auth.toke... | it 'should configure any previously added collection routes', (test) ->
route = Restivus.routes[1]
test.equal route.endpoints.get.action(), 2
test.isTrue route.endpoints.get.authRequired
test.equal route.endpoints.get.roleRequired, ['admin']
describe 'A collection route', ->... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 43 | 83 |
kahmali/meteor-restivus:test/api_tests.coffee:3:raw_corpus | raw_corpus | HTTP.get 'http://localhost:3000/api/v1/tests2/', (error, result) ->
response = JSON.parse result.content
test.isTrue error
test.equal result.statusCode, 404
test.equal response.status, 'error'
test.equal response.message, 'API endpoint not found'
next()
d... | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 85 | 123 | ||
kahmali/meteor-restivus:test/api_tests.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
HTTP.get 'http://localhost:3000/api/v1/tests2/', (error, result) ->
response = JSON.parse result.content
test.isTrue error
test.equal result.statusCode, 404
test.equal response.status, 'error'
test.equal response.... | HTTP.get('http://localhost:3000/api/v1/tests2/', function(error, result) {
var response;
response = JSON.parse(result.content);
test.isTrue(error);
test.equal(result.statusCode, 404);
test.equal(response.status, 'error');
test.equal(response.message, 'API endpoint not found');
return next();
});
describe... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 85 | 123 |
kahmali/meteor-restivus:test/api_tests.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
HTTP.get('http://localhost:3000/api/v1/tests2/', function(error, result) {
var response;
response = JSON.parse(result.content);
test.isTrue(error);
test.equal(result.statusCode, 404);
test.equal(response.status, 'error');
test.equal(response.message, 'A... | HTTP.get 'http://localhost:3000/api/v1/tests2/', (error, result) ->
response = JSON.parse result.content
test.isTrue error
test.equal result.statusCode, 404
test.equal response.status, 'error'
test.equal response.message, 'API endpoint not found'
next()
d... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 85 | 123 |
kahmali/meteor-restivus:test/api_tests.coffee:3:completion | completion | HTTP.get 'http://localhost:3000/api/v1/tests2/', (error, result) ->
response = JSON.parse result.content
test.isTrue error
test.equal result.statusCode, 404
test.equal response.status, 'error'
test.equal response.message, 'API endpoint not found'
next()
d... | it 'should cause an error when it returns undefined', (test, next) ->
Restivus.addRoute 'testUndefinedResponse',
get: ->
undefined
HTTP.get 'http://localhost:3000/api/v1/testUndefinedResponse', (error, result) ->
test.isTrue error
test.equal result.statusCode, ... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 85 | 123 |
kahmali/meteor-restivus:test/api_tests.coffee:4:raw_corpus | raw_corpus | test.equal result.statusCode, 200
test.equal response, 'Testing manual response.'
next()
it 'should not have to call this.response.end() when handling the response manually', (test, next) ->
Restivus.addRoute 'testManualResponseNoEnd',
get: ->
@response.write 'Te... | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 125 | 165 | ||
kahmali/meteor-restivus:test/api_tests.coffee:4:completion | completion | test.equal result.statusCode, 200
test.equal response, 'Testing manual response.'
next()
it 'should not have to call this.response.end() when handling the response manually', (test, next) ->
Restivus.addRoute 'testManualResponseNoEnd',
get: ->
@response.write 'Te... | get: ->
@response.write 'Testing '
@response.write 'chunked response.'
# @done()
HTTP.get 'http://localhost:3000/api/v1/testChunkedResponse', (error, result) ->
response = result.content
test.equal result.statusCode, 200
test.equal response, 'Te... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a | 541 | https://github.com/kahmali/meteor-restivus/blob/e5e0035d13c9853f8d562e0f3d676c51ca8aeb3a/test/api_tests.coffee | 125 | 165 |
kahmali/meteor-restivus:test/api_tests.coffee:1:raw_corpus | raw_corpus | if Meteor.isServer
Meteor.startup ->
describe 'A Restivus API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.config.useAuth
test.isFalse Restivus.config.prett... | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 7a52352187880d9a1091cec88ee0800c51f7059d | 541 | https://github.com/kahmali/meteor-restivus/blob/7a52352187880d9a1091cec88ee0800c51f7059d/test/api_tests.coffee | 1 | 41 | ||
kahmali/meteor-restivus:test/api_tests.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if Meteor.isServer
Meteor.startup ->
describe 'A Restivus API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.co... | if (Meteor.isServer) {
Meteor.startup(function() {
return describe('A Restivus API', function() {
return context('that hasn\'t been configured', function() {
it('should have default settings', function(test) {
test.equal(Restivus.config.apiPath, 'api/');
test.isFalse(Restivus.con... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 7a52352187880d9a1091cec88ee0800c51f7059d | 541 | https://github.com/kahmali/meteor-restivus/blob/7a52352187880d9a1091cec88ee0800c51f7059d/test/api_tests.coffee | 1 | 41 |
kahmali/meteor-restivus:test/api_tests.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (Meteor.isServer) {
Meteor.startup(function() {
return describe('A Restivus API', function() {
return context('that hasn\'t been configured', function() {
it('should have default settings', function(test) {
test.equal(Restivus.confi... | if Meteor.isServer
Meteor.startup ->
describe 'A Restivus API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.config.useAuth
test.isFalse Restivus.config.prett... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 7a52352187880d9a1091cec88ee0800c51f7059d | 541 | https://github.com/kahmali/meteor-restivus/blob/7a52352187880d9a1091cec88ee0800c51f7059d/test/api_tests.coffee | 1 | 41 |
kahmali/meteor-restivus:test/api_tests.coffee:1:completion | completion | if Meteor.isServer
Meteor.startup ->
describe 'A Restivus API', ->
context 'that hasn\'t been configured', ->
it 'should have default settings', (test) ->
test.equal Restivus.config.apiPath, 'api/'
test.isFalse Restivus.config.useAuth
test.isFalse Restivus.config.prett... | test.equal route.options.roleRequired, 'admin'
test.isUndefined route.endpoints.get.authRequired
test.isUndefined route.endpoints.get.roleRequired
it 'should allow you to add an unconfigured collection route', (test) ->
Restivus.addCollection new Mongo.Collection('tests'),
... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 7a52352187880d9a1091cec88ee0800c51f7059d | 541 | https://github.com/kahmali/meteor-restivus/blob/7a52352187880d9a1091cec88ee0800c51f7059d/test/api_tests.coffee | 1 | 41 |
kahmali/meteor-restivus:test/api_tests.coffee:3:raw_corpus | raw_corpus | HTTP.get 'http://localhost:3000/api/v1/tests2/', (error, result) ->
response = JSON.parse result.content
test.isTrue error
test.equal result.statusCode, 404
test.equal response.status, 'error'
test.equal response.message, 'API endpoint not found'
next()
# ... | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 7a52352187880d9a1091cec88ee0800c51f7059d | 541 | https://github.com/kahmali/meteor-restivus/blob/7a52352187880d9a1091cec88ee0800c51f7059d/test/api_tests.coffee | 85 | 107 | ||
kahmali/meteor-restivus:test/api_tests.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
HTTP.get 'http://localhost:3000/api/v1/tests2/', (error, result) ->
response = JSON.parse result.content
test.isTrue error
test.equal result.statusCode, 404
test.equal response.status, 'error'
test.equal response.... | HTTP.get('http://localhost:3000/api/v1/tests2/', function(error, result) {
var response;
response = JSON.parse(result.content);
test.isTrue(error);
test.equal(result.statusCode, 404);
test.equal(response.status, 'error');
test.equal(response.message, 'API endpoint not found');
return next();
});
// de... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 7a52352187880d9a1091cec88ee0800c51f7059d | 541 | https://github.com/kahmali/meteor-restivus/blob/7a52352187880d9a1091cec88ee0800c51f7059d/test/api_tests.coffee | 85 | 107 |
kahmali/meteor-restivus:test/api_tests.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
HTTP.get('http://localhost:3000/api/v1/tests2/', function(error, result) {
var response;
response = JSON.parse(result.content);
test.isTrue(error);
test.equal(result.statusCode, 404);
test.equal(response.status, 'error');
test.equal(response.message, 'A... | HTTP.get 'http://localhost:3000/api/v1/tests2/', (error, result) ->
response = JSON.parse result.content
test.isTrue error
test.equal result.statusCode, 404
test.equal response.status, 'error'
test.equal response.message, 'API endpoint not found'
next()
# ... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 7a52352187880d9a1091cec88ee0800c51f7059d | 541 | https://github.com/kahmali/meteor-restivus/blob/7a52352187880d9a1091cec88ee0800c51f7059d/test/api_tests.coffee | 85 | 107 |
kahmali/meteor-restivus:test/api_tests.coffee:2:raw_corpus | raw_corpus | it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
prettyJson: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'api/v1/'
test.equal config.useAuth, true
... | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 925b8ff7ee757da89d6f18bc284ab981b48846fa | 541 | https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/api_tests.coffee | 43 | 81 | ||
kahmali/meteor-restivus:test/api_tests.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
prettyJson: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'ap... | it('should be configurable', function(test) {
var config;
Restivus.configure({
apiPath: 'api/v1',
useAuth: true,
prettyJson: true,
auth: {
token: 'apiKey'
}
});
config = Restivus.config;
test.equal(config.apiPath, 'api/v1/');
test.equal(config.useAuth, true);
test.equal(config.pr... | CoffeeScript | JavaScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 925b8ff7ee757da89d6f18bc284ab981b48846fa | 541 | https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/api_tests.coffee | 43 | 81 |
kahmali/meteor-restivus:test/api_tests.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should be configurable', function(test) {
var config;
Restivus.configure({
apiPath: 'api/v1',
useAuth: true,
prettyJson: true,
auth: {
token: 'apiKey'
}
});
config = Restivus.config;
test.equal(config.apiPath, 'api/v1/');
t... | it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
prettyJson: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'api/v1/'
test.equal config.useAuth, true
... | JavaScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 925b8ff7ee757da89d6f18bc284ab981b48846fa | 541 | https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/api_tests.coffee | 43 | 81 |
kahmali/meteor-restivus:test/api_tests.coffee:2:completion | completion | it 'should be configurable', (test) ->
Restivus.configure
apiPath: 'api/v1'
useAuth: true
prettyJson: true
auth: token: 'apiKey'
config = Restivus.config
test.equal config.apiPath, 'api/v1/'
test.equal config.useAuth, true
... | test.equal route.endpoints.get.action(), 1
test.isTrue route.endpoints.get.authRequired
test.equal route.endpoints.get.roleRequired, ['admin']
it 'should configure any previously added collection routes', (test) ->
route = Restivus.routes[1]
test.equal route.endpoints.ge... | CoffeeScript | CoffeeScript | kahmali/meteor-restivus | test/api_tests.coffee | MIT | 925b8ff7ee757da89d6f18bc284ab981b48846fa | 541 | https://github.com/kahmali/meteor-restivus/blob/925b8ff7ee757da89d6f18bc284ab981b48846fa/test/api_tests.coffee | 43 | 81 |
jashkenas/coffeescript:documentation/v1/code.coffee:1:raw_corpus | raw_corpus | fs = require 'fs'
CoffeeScript = require '../../lib/coffeescript'
module.exports = ->
counter = 0
hljs = require 'highlight.js'
hljs.configure classPrefix: ''
(file, executable = no, showLoad = yes) ->
counter++
cs = fs.readFileSync "documentation/examples/#{file}.coffee", 'utf-8'
js = C... | CoffeeScript | jashkenas/coffeescript | documentation/v1/code.coffee | MIT | 4cc701a9da0132efbb5c58c142cec0348443ec1d | 16,577 | https://github.com/jashkenas/coffeescript/blob/4cc701a9da0132efbb5c58c142cec0348443ec1d/documentation/v1/code.coffee | 1 | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.