trackler 2.2.1.42 → 2.2.1.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/change/metadata.yml +2 -0
- data/problem-specifications/exercises/crypto-square/canonical-data.json +10 -65
- data/tracks/c/bin/run-tests +3 -0
- data/tracks/c/exercises/acronym/test/test_acronym.c +8 -0
- data/tracks/c/exercises/all-your-base/test/test_all_your_base.c +19 -0
- data/tracks/c/exercises/allergies/test/test_allergies.c +13 -0
- data/tracks/c/exercises/anagram/src/anagram.h +2 -2
- data/tracks/c/exercises/anagram/src/example.c +5 -5
- data/tracks/c/exercises/anagram/test/test_anagram.c +39 -29
- data/tracks/c/exercises/atbash-cipher/test/test_atbash_cipher.c +12 -0
- data/tracks/c/exercises/beer-song/test/test_beer_song.c +5 -0
- data/tracks/c/exercises/binary-search/test/test_binary_search.c +10 -0
- data/tracks/c/exercises/binary/test/test_binary.c +14 -0
- data/tracks/c/exercises/bob/test/test_bob.c +16 -0
- data/tracks/c/exercises/clock/test/test_clock.c +34 -0
- data/tracks/c/exercises/difference-of-squares/test/test_difference_of_squares.c +9 -0
- data/tracks/c/exercises/gigasecond/test/test_gigasecond.c +4 -0
- data/tracks/c/exercises/grains/test/test_grains.c +9 -0
- data/tracks/c/exercises/hamming/test/test_hamming.c +12 -0
- data/tracks/c/exercises/isogram/src/example.c +6 -6
- data/tracks/c/exercises/isogram/src/example.h +1 -1
- data/tracks/c/exercises/isogram/test/test_isogram.c +17 -9
- data/tracks/c/exercises/largest-series-product/test/test_largest_series_product.c +15 -0
- data/tracks/c/exercises/leap/test/test_leap.c +4 -0
- data/tracks/c/exercises/nth-prime/test/test_nth_prime.c +4 -0
- data/tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c +4 -0
- data/tracks/c/exercises/palindrome-products/test/test_palindrome_products.c +1 -0
- data/tracks/c/exercises/pangram/test/test_pangram.c +11 -0
- data/tracks/c/exercises/pascals-triangle/test/test_pascals_triangle.c +5 -0
- data/tracks/c/exercises/perfect-numbers/test/test_perfect_numbers.c +12 -0
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +13 -0
- data/tracks/c/exercises/raindrops/test/test_raindrops.c +17 -0
- data/tracks/c/exercises/react/test/test_react.c +14 -0
- data/tracks/c/exercises/rna-transcription/test/test_rna_transcription.c +7 -0
- data/tracks/c/exercises/robot-simulator/test/test_robot_simulator.c +11 -0
- data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +17 -0
- data/tracks/c/exercises/scrabble-score/test/test_scrabble_score.c +10 -0
- data/tracks/c/exercises/sieve/test/test_sieve.c +4 -0
- data/tracks/c/exercises/space-age/test/test_space_age.c +7 -0
- data/tracks/c/exercises/sum-of-multiples/test/test_sum_of_multiples.c +11 -0
- data/tracks/c/exercises/triangle/test/test_triangle.c +15 -0
- data/tracks/c/exercises/word-count/test/test_word_count.c +10 -0
- data/tracks/dart/.travis.yml +2 -7
- data/tracks/dart/bin/check_formatting +9 -0
- data/tracks/dart/exercises/bob/pubspec.lock +26 -26
- data/tracks/dart/exercises/difference-of-squares/pubspec.lock +26 -26
- data/tracks/dart/exercises/gigasecond/pubspec.lock +26 -26
- data/tracks/dart/exercises/hamming/pubspec.lock +26 -26
- data/tracks/dart/exercises/hello-world/pubspec.lock +26 -26
- data/tracks/dart/exercises/leap/pubspec.lock +26 -26
- data/tracks/dart/exercises/rna-transcription/pubspec.lock +26 -26
- data/tracks/dart/exercises/rna-transcription/test/rna_transcription_test.dart +1 -1
- data/tracks/dart/pubspec.lock +42 -30
- data/tracks/dart/pubspec.yaml +3 -3
- data/tracks/dart/test/exercises_test.dart +52 -14
- data/tracks/dart/tool/create-exercise +1 -1
- data/tracks/erlang/.travis.yml +2 -2
- data/tracks/erlang/config.json +10 -0
- data/tracks/erlang/exercises/bank-account/src/example.erl +67 -41
- data/tracks/erlang/exercises/bank-account/test/bank_account_tests.erl +0 -6
- data/tracks/erlang/exercises/luhn/src/example.erl +32 -14
- data/tracks/erlang/exercises/luhn/test/luhn_tests.erl +36 -10
- data/tracks/erlang/exercises/two-fer/README.md +19 -0
- data/tracks/erlang/exercises/two-fer/include/exercism.hrl +11 -0
- data/tracks/erlang/exercises/two-fer/rebar.config +30 -0
- data/tracks/erlang/exercises/two-fer/src/example.erl +11 -0
- data/tracks/erlang/exercises/two-fer/src/two_fer.app.src +9 -0
- data/tracks/erlang/exercises/two-fer/src/two_fer.erl +11 -0
- data/tracks/erlang/exercises/two-fer/test/two_fer_tests.erl +15 -0
- data/tracks/java/config.json +26 -3
- data/tracks/java/exercises/list-ops/.meta/hints.md +4 -0
- data/tracks/javascript/config.json +14 -0
- data/tracks/javascript/docs/ABOUT.md +16 -9
- data/tracks/javascript/exercises/diffie-hellman/README.md +73 -0
- data/tracks/javascript/exercises/diffie-hellman/diffie-hellman.spec.js +73 -0
- data/tracks/javascript/exercises/diffie-hellman/example.js +48 -0
- data/tracks/julia/config.json +1 -1
- data/tracks/python/exercises/accumulate/accumulate.py +1 -1
- data/tracks/python/exercises/allergies/allergies.py +2 -2
- data/tracks/python/exercises/alphametics/alphametics.py +1 -1
- data/tracks/python/exercises/anagram/anagram.py +1 -1
- data/tracks/python/exercises/binary-search/binary_search.py +1 -1
- data/tracks/python/exercises/binary/binary.py +1 -1
- data/tracks/python/exercises/collatz-conjecture/collatz_conjecture.py +1 -1
- data/tracks/python/exercises/crypto-square/crypto_square.py +1 -1
- data/tracks/python/exercises/diamond/diamond.py +1 -1
- data/tracks/python/exercises/grep/grep.py +2 -0
- data/tracks/python/exercises/hello-world/hello_world.py +1 -1
- data/tracks/python/exercises/largest-series-product/largest_series_product.py +1 -1
- data/tracks/python/exercises/minesweeper/minesweeper.py +2 -1
- data/tracks/python/exercises/nucleotide-count/nucleotide_count.py +2 -2
- data/tracks/python/exercises/ocr-numbers/ocr_numbers.py +2 -2
- data/tracks/python/exercises/octal/octal.py +1 -1
- data/tracks/python/exercises/pangram/pangram.py +1 -1
- data/tracks/python/exercises/pascals-triangle/pascals_triangle.py +3 -3
- data/tracks/python/exercises/poker/poker.py +1 -1
- data/tracks/python/exercises/prime-factors/prime_factors.py +1 -1
- data/tracks/python/exercises/protein-translation/protein_translation.py +2 -2
- data/tracks/python/exercises/proverb/proverb.py +1 -1
- data/tracks/python/exercises/queen-attack/queen_attack.py +2 -2
- data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher.py +3 -3
- data/tracks/python/exercises/roman-numerals/roman_numerals.py +1 -1
- data/tracks/python/exercises/rotational-cipher/rotational_cipher.py +1 -1
- data/tracks/python/exercises/say/say.py +1 -1
- data/tracks/python/exercises/secret-handshake/secret_handshake.py +2 -2
- data/tracks/python/exercises/space-age/space_age.py +1 -1
- data/tracks/python/exercises/tournament/tournament.py +1 -1
- data/tracks/python/exercises/trinary/trinary.py +1 -1
- data/tracks/python/exercises/two-fer/two_fer.py +1 -1
- data/tracks/python/exercises/word-count/word_count.py +1 -1
- data/tracks/ruby/lib/generator/exercise_case.rb +1 -1
- data/tracks/ruby/test/generator/exercise_case_test.rb +10 -0
- data/tracks/scala/testgen/src/main/resources/version-check-ignore.txt +1 -2
- data/tracks/sml/exercises/accumulate/README.md +19 -14
- data/tracks/sml/exercises/accumulate/accumulate.sml +1 -1
- data/tracks/sml/exercises/accumulate/example.sml +2 -2
- data/tracks/sml/exercises/accumulate/test.sml +26 -56
- data/tracks/sml/exercises/accumulate/testlib.sml +159 -0
- metadata +15 -2
@@ -29,10 +29,8 @@ deposit_fail_test() ->
|
|
29
29
|
deposit_many_test() ->
|
30
30
|
BankAccount = ?TESTED_MODULE:create(),
|
31
31
|
[erlang:spawn( fun () -> ?TESTED_MODULE:deposit(BankAccount, X) end ) || X <- lists:seq(1, 10)],
|
32
|
-
First = ?TESTED_MODULE:balance(BankAccount),
|
33
32
|
timer:sleep(100),
|
34
33
|
Last = ?TESTED_MODULE:balance(BankAccount),
|
35
|
-
?assert(First < 55),
|
36
34
|
?assert(Last =:= 55).
|
37
35
|
|
38
36
|
withdraw_test() ->
|
@@ -60,10 +58,8 @@ withdraw_many_test() ->
|
|
60
58
|
BankAccount = ?TESTED_MODULE:create(),
|
61
59
|
?TESTED_MODULE:deposit(BankAccount, 55 ),
|
62
60
|
[erlang:spawn( fun () -> ?TESTED_MODULE:withdraw(BankAccount, X) end ) || X <- lists:seq(1, 10)],
|
63
|
-
First = ?TESTED_MODULE:balance(BankAccount),
|
64
61
|
timer:sleep(100),
|
65
62
|
Last = ?TESTED_MODULE:balance(BankAccount),
|
66
|
-
?assert(First > 0),
|
67
63
|
?assert(Last =:= 0).
|
68
64
|
|
69
65
|
charge_test() ->
|
@@ -91,8 +87,6 @@ charge_many_test() ->
|
|
91
87
|
BankAccount = ?TESTED_MODULE:create(),
|
92
88
|
?TESTED_MODULE:deposit(BankAccount, 55 ),
|
93
89
|
[erlang:spawn( fun () -> ?TESTED_MODULE:charge(BankAccount, 10) end ) || _X <- lists:seq(1, 10)],
|
94
|
-
First = ?TESTED_MODULE:balance(BankAccount),
|
95
90
|
timer:sleep(100),
|
96
91
|
Last = ?TESTED_MODULE:balance(BankAccount),
|
97
|
-
?assert(First > 0),
|
98
92
|
?assert(Last =:= 5).
|
@@ -1,17 +1,12 @@
|
|
1
1
|
-module(example).
|
2
|
-
-export([valid/1,
|
2
|
+
-export([valid/1, test_version/0]).
|
3
3
|
|
4
4
|
|
5
5
|
|
6
6
|
checksum(Number) ->
|
7
7
|
checksum(
|
8
8
|
lists:reverse(
|
9
|
-
|
10
|
-
fun(C) ->
|
11
|
-
($0 =< C) andalso (C =< $9)
|
12
|
-
end,
|
13
|
-
Number
|
14
|
-
)
|
9
|
+
filter_input(Number)
|
15
10
|
),
|
16
11
|
odd,
|
17
12
|
0
|
@@ -19,6 +14,26 @@ checksum(Number) ->
|
|
19
14
|
|
20
15
|
|
21
16
|
|
17
|
+
is_numeric(Number) ->
|
18
|
+
lists:all(
|
19
|
+
fun(C) ->
|
20
|
+
(($0 =< C) andalso (C =< $9)) or (C == $\s)
|
21
|
+
end,
|
22
|
+
Number
|
23
|
+
).
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
filter_input(Number) ->
|
28
|
+
lists:filter(
|
29
|
+
fun(C) ->
|
30
|
+
($0 =< C) andalso (C =< $9)
|
31
|
+
end,
|
32
|
+
Number
|
33
|
+
).
|
34
|
+
|
35
|
+
|
36
|
+
|
22
37
|
checksum([], _, Total) ->
|
23
38
|
Total;
|
24
39
|
|
@@ -34,14 +49,17 @@ checksum([H | ReversedNumber], even, Total) when H >= $5 ->
|
|
34
49
|
|
35
50
|
|
36
51
|
valid(Number) ->
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
52
|
+
case is_numeric(Number) of
|
53
|
+
true ->
|
54
|
+
case filter_input(Number) of
|
55
|
+
Number2 = [_,_|_] ->
|
56
|
+
checksum(Number2) rem 10 == 0;
|
57
|
+
_ -> false
|
58
|
+
end;
|
59
|
+
_ -> false
|
60
|
+
end.
|
43
61
|
|
44
62
|
|
45
63
|
|
46
64
|
test_version() ->
|
47
|
-
|
65
|
+
2.
|
@@ -1,18 +1,44 @@
|
|
1
1
|
-module(luhn_tests).
|
2
2
|
|
3
3
|
-define(TESTED_MODULE, (sut(luhn))).
|
4
|
-
-define(TEST_VERSION,
|
4
|
+
-define(TEST_VERSION, 2).
|
5
5
|
-include("exercism.hrl").
|
6
6
|
|
7
|
+
single_digit_strings_can_not_be_valid_test() ->
|
8
|
+
?assertNot(?TESTED_MODULE:valid("1")).
|
7
9
|
|
8
|
-
|
9
|
-
?assertNot(?TESTED_MODULE:valid("
|
10
|
-
?assertNot(?TESTED_MODULE:valid("738")).
|
10
|
+
a_single_zero_is_invalid_test() ->
|
11
|
+
?assertNot(?TESTED_MODULE:valid("0")).
|
11
12
|
|
12
|
-
|
13
|
-
?assert(?TESTED_MODULE:valid("
|
14
|
-
?assert(?TESTED_MODULE:valid("8763")),
|
15
|
-
?assert(?TESTED_MODULE:valid("2323 2005 7766 3554")).
|
13
|
+
a_simple_valid_sin_that_remains_valid_if_reversed_test() ->
|
14
|
+
?assert(?TESTED_MODULE:valid("059")).
|
16
15
|
|
17
|
-
|
18
|
-
?
|
16
|
+
a_simple_valid_sin_that_becomes_invalid_if_reversed_test() ->
|
17
|
+
?assert(?TESTED_MODULE:valid("59")).
|
18
|
+
|
19
|
+
a_valid_canadian_sin_test() ->
|
20
|
+
?assert(?TESTED_MODULE:valid("055 444 285")).
|
21
|
+
|
22
|
+
invalid_canadian_sin_test() ->
|
23
|
+
?assertNot(?TESTED_MODULE:valid("055 444 286")).
|
24
|
+
|
25
|
+
invalid_credit_card_test() ->
|
26
|
+
?assertNot(?TESTED_MODULE:valid("8273 1232 7352 0569")).
|
27
|
+
|
28
|
+
valid_strings_with_a_non_digit_included_become_invalid_test() ->
|
29
|
+
?assertNot(?TESTED_MODULE:valid("055a 444 285")).
|
30
|
+
|
31
|
+
valid_strings_with_punctuation_included_become_invalid_test() ->
|
32
|
+
?assertNot(?TESTED_MODULE:valid("055-444-285")).
|
33
|
+
|
34
|
+
valid_strings_with_symbols_included_become_invalid_test() ->
|
35
|
+
?assertNot(?TESTED_MODULE:valid("055£ 444$ 285")).
|
36
|
+
|
37
|
+
single_zero_with_space_is_invalid_test() ->
|
38
|
+
?assertNot(?TESTED_MODULE:valid(" 0")).
|
39
|
+
|
40
|
+
more_than_a_single_zero_is_valid_test() ->
|
41
|
+
?assert(?TESTED_MODULE:valid("0000 0")).
|
42
|
+
|
43
|
+
input_digit_9_is_correctly_converted_to_output_digit_9_test() ->
|
44
|
+
?assert(?TESTED_MODULE:valid("091")).
|
@@ -0,0 +1,19 @@
|
|
1
|
+
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
|
2
|
+
|
3
|
+
```text
|
4
|
+
"One for X, one for me."
|
5
|
+
```
|
6
|
+
|
7
|
+
When X is a name or "you".
|
8
|
+
|
9
|
+
If the given name is "Alice", the result should be "One for Alice, one for me."
|
10
|
+
If no name is given, the result should be "One for you, one for me."
|
11
|
+
|
12
|
+
## Instructions
|
13
|
+
|
14
|
+
Submissions are encouraged to be general, within reason. Having said that, it's
|
15
|
+
also important not to over-engineer a solution.
|
16
|
+
|
17
|
+
It's important to remember that the goal is to make code as expressive and
|
18
|
+
readable as we can.
|
19
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
3
|
+
sut(Module) ->
|
4
|
+
{ok, Files} = file:list_dir("./src"),
|
5
|
+
case lists:member("example.erl", Files) of
|
6
|
+
true -> example;
|
7
|
+
false -> Module
|
8
|
+
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
-module(two_fer_tests).
|
2
|
+
|
3
|
+
-define(TESTED_MODULE, (sut(two_fer))).
|
4
|
+
-define(TEST_VERSION, 1).
|
5
|
+
-include("exercism.hrl").
|
6
|
+
|
7
|
+
|
8
|
+
say_you_test() ->
|
9
|
+
?assertEqual("One for you, one for me.", ?TESTED_MODULE:two_fer()).
|
10
|
+
|
11
|
+
say_alice_test() ->
|
12
|
+
?assertEqual("One for Alice, one for me.", ?TESTED_MODULE:two_fer("Alice")).
|
13
|
+
|
14
|
+
say_bob_test() ->
|
15
|
+
?assertEqual("One for Bob, one for me.", ?TESTED_MODULE:two_fer("Bob")).
|
data/tracks/java/config.json
CHANGED
@@ -156,7 +156,13 @@
|
|
156
156
|
"core": false,
|
157
157
|
"difficulty": 3,
|
158
158
|
"slug": "perfect-numbers",
|
159
|
-
"topics":
|
159
|
+
"topics": [
|
160
|
+
"integers",
|
161
|
+
"mathematics",
|
162
|
+
"exception_handling",
|
163
|
+
"enumerations",
|
164
|
+
"filtering"
|
165
|
+
],
|
160
166
|
"unlocked_by": "difference-of-squares",
|
161
167
|
"uuid": "d0dcc898-ec38-4822-9e3c-1a1829c9b2d9"
|
162
168
|
},
|
@@ -252,7 +258,15 @@
|
|
252
258
|
"core": false,
|
253
259
|
"difficulty": 4,
|
254
260
|
"slug": "kindergarten-garden",
|
255
|
-
"topics":
|
261
|
+
"topics": [
|
262
|
+
"loops",
|
263
|
+
"arrays",
|
264
|
+
"strings",
|
265
|
+
"logic",
|
266
|
+
"pattern_recognition",
|
267
|
+
"enumerations",
|
268
|
+
"lists"
|
269
|
+
],
|
256
270
|
"unlocked_by": "matrix",
|
257
271
|
"uuid": "0b92ffee-c092-4ab1-ad78-76c8cf80e1b5"
|
258
272
|
},
|
@@ -607,7 +621,16 @@
|
|
607
621
|
"core": false,
|
608
622
|
"difficulty": 6,
|
609
623
|
"slug": "wordy",
|
610
|
-
"topics":
|
624
|
+
"topics": [
|
625
|
+
"strings",
|
626
|
+
"integers",
|
627
|
+
"logic",
|
628
|
+
"parsing",
|
629
|
+
"pattern_matching",
|
630
|
+
"regular_expressions",
|
631
|
+
"transforming",
|
632
|
+
"exception_handling"
|
633
|
+
],
|
611
634
|
"unlocked_by": "secret-handshake",
|
612
635
|
"uuid": "3310a3cd-c0cb-45fa-8c51-600178be904a"
|
613
636
|
},
|
@@ -1,3 +1,7 @@
|
|
1
1
|
## Hints
|
2
2
|
|
3
|
+
In Java it's considered best practice to use instance methods over class methods. However, there are conditions in which it is absolutely appropriate for a function to be `static`. Since classes in Java are closed for modification (i.e. you cannot add members to a class outside its definition like you can in other languages like Ruby or JavaScript), you cannot add new behavior to the class directly. What to do if you still want to define behavior for a given type? The idiomatic solution in this case is to write a utility method.
|
4
|
+
Collections of these kinds of methods are often referred to as "utility classes". Examples of such classes from within the JRE include [Arrays](https://docs.oracle.com/javase/9/docs/api/java/util/Arrays.html) and [Collections](https://docs.oracle.com/javase/9/docs/api/java/util/Collections.html).
|
5
|
+
In this exercise we want a List to have `map()`, `reduce()`, `filter()`, etc. methods. It doesn't, so we're using static methods.
|
6
|
+
|
3
7
|
The `foldLeft` and `foldRight` methods are "fold" functions, which is a concept well-known in the functional programming world, but less so in the object-oriented one. See the Wikipedia page on folding for [general background](https://en.wikipedia.org/wiki/Fold_(higher-order_function)) and [signature/implementation hints](https://en.wikipedia.org/wiki/Fold_(higher-order_function)#Linear_folds).
|
@@ -1029,6 +1029,20 @@
|
|
1029
1029
|
"unlocked_by": "linked-list",
|
1030
1030
|
"uuid": "c21ab6e8-b845-49d0-a2f6-1c89c7a07626"
|
1031
1031
|
},
|
1032
|
+
{
|
1033
|
+
"uuid": "833bd7c7-d3d8-45fd-a218-12dea646065d",
|
1034
|
+
"slug": "diffie-hellman",
|
1035
|
+
"core": false,
|
1036
|
+
"unlocked_by": "simple-cipher",
|
1037
|
+
"difficulty": 3,
|
1038
|
+
"topics": [
|
1039
|
+
"Control-flow (conditionals)",
|
1040
|
+
"Control-flow (loops)",
|
1041
|
+
"Algorithms",
|
1042
|
+
"Arrays",
|
1043
|
+
"Exception handling"
|
1044
|
+
]
|
1045
|
+
},
|
1032
1046
|
{
|
1033
1047
|
"core" : false,
|
1034
1048
|
"difficulty" : 8,
|
@@ -1,22 +1,29 @@
|
|
1
|
-
|
1
|
+
JavaScript is a scripting language used to provide dynamic and interactive content on webpages.
|
2
|
+
Also, server side JS allows the use of the same language on the server and client.
|
3
|
+
|
4
|
+
Besides being fast, JavaScript provides benefits like:
|
2
5
|
|
3
6
|
* Reducing server traffic by validating user input in the browser before it is sent to the server.
|
4
|
-
* Providing immediate feedback to the site visitors so that they don't have to reload pages just to get error messages on form validations.
|
7
|
+
* Providing immediate feedback to the site's visitors so that they don't have to reload pages just to get error messages on form validations.
|
5
8
|
* Allowing richer user interfaces with content changes on mouse hover, drag and drop gestures, and animations.
|
6
9
|
|
7
|
-
Client-side JavaScript is interpreted in the browser without requiring compilation.
|
10
|
+
Client-side JavaScript is interpreted in the browser without requiring compilation.
|
11
|
+
This allows interactive content to be included in HTML pages which would otherwise be static.
|
8
12
|
|
9
|
-
Server-Side JavaScript as run in NodeJS enables back-end access to databases, file systems, and servers.
|
13
|
+
Server-Side JavaScript as run in NodeJS enables back-end access to databases, file systems, and servers.
|
14
|
+
NodeJS is built on Google Chrome's JavaScript V8 Engine.
|
15
|
+
NodeJS uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
|
16
|
+
Node can be a great solution for applications requiring I/O bound operations, data streaming etc.
|
17
|
+
More details can be found [here](https://nodejs.org/en/about/).
|
10
18
|
|
11
19
|
You should learn JavaScript because:
|
12
20
|
|
13
21
|
* It's easy to learn.
|
14
|
-
* It's versatile in the sense that it's multi-paradigm supporting procedural, event based, object oriented and functional programming.
|
15
|
-
* It can be used for the
|
22
|
+
* It's versatile in the sense that it's multi-paradigm - supporting procedural, event based, object oriented and functional programming.
|
23
|
+
* It can be used for the front-end and back-end.
|
16
24
|
* It's Open Source.
|
17
25
|
* JavaScript programming skills are in high demand.
|
18
26
|
|
19
|
-
|
20
|
-
|
21
|
-
_This track is intended for widely supported JavaScript, for code that could be executed in almost all existing browsers. If you're looking for experimenting with newer features of the language try the [ECMAScript](http://exercism.io/languages/ecmascript) track._
|
27
|
+
_This track is intended for widely supported JavaScript, for code that could be executed in almost all existing browsers.
|
28
|
+
If you're looking to experiment with newer features of the language, try the [ECMAScript](http://exercism.io/languages/ecmascript) track._
|
22
29
|
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Diffie Hellman
|
2
|
+
|
3
|
+
Diffie-Hellman key exchange.
|
4
|
+
|
5
|
+
Alice and Bob use Diffie-Hellman key exchange to share secrets. They
|
6
|
+
start with prime numbers, pick private keys, generate and share public
|
7
|
+
keys, and then generate a shared secret key.
|
8
|
+
|
9
|
+
## Step 0
|
10
|
+
|
11
|
+
The test program supplies prime numbers p and g.
|
12
|
+
|
13
|
+
## Step 1
|
14
|
+
|
15
|
+
Alice picks a private key, a, greater than 1 and less than p. Bob does
|
16
|
+
the same to pick a private key b.
|
17
|
+
|
18
|
+
## Step 2
|
19
|
+
|
20
|
+
Alice calculates a public key A.
|
21
|
+
|
22
|
+
A = g**a mod p
|
23
|
+
|
24
|
+
Using the same p and g, Bob similarly calculates a public key B from his
|
25
|
+
private key b.
|
26
|
+
|
27
|
+
## Step 3
|
28
|
+
|
29
|
+
Alice and Bob exchange public keys. Alice calculates secret key s.
|
30
|
+
|
31
|
+
s = B**a mod p
|
32
|
+
|
33
|
+
Bob calculates
|
34
|
+
|
35
|
+
s = A**b mod p
|
36
|
+
|
37
|
+
The calculations produce the same result! Alice and Bob now share
|
38
|
+
secret s.
|
39
|
+
|
40
|
+
## Setup
|
41
|
+
|
42
|
+
Go through the setup instructions for JavaScript to
|
43
|
+
install the necessary dependencies:
|
44
|
+
|
45
|
+
http://exercism.io/languages/javascript
|
46
|
+
|
47
|
+
## Requirements
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
## Making the test suite pass
|
52
|
+
|
53
|
+
Execute the tests with:
|
54
|
+
|
55
|
+
jasmine <exercise-name>.spec.js
|
56
|
+
|
57
|
+
Replace `<exercise-name>` with the name of the current exercise. E.g., to
|
58
|
+
test the Hello World exercise:
|
59
|
+
|
60
|
+
jasmine hello-world.spec.js
|
61
|
+
|
62
|
+
In many test suites all but the first test have been skipped.
|
63
|
+
|
64
|
+
Once you get a test passing, you can unskip the next one by
|
65
|
+
changing `xit` to `it`.
|
66
|
+
|
67
|
+
|
68
|
+
## Source
|
69
|
+
|
70
|
+
Wikipedia, 1024 bit key from www.cryptopp.com/wiki. [http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange](http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange)
|
71
|
+
|
72
|
+
## Submitting Incomplete Solutions
|
73
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|