Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions exercism/accumulate/accumulate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function accumulate() {
return "hello"
}

module.exports {accumulate}
79 changes: 79 additions & 0 deletions exercism/beer-song/beer-song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
var BeerSong = function(){};

BeerSong.prototype.verse = function (verse) {

if (verse === 2) {
song = (verse + ' bottles of beer on the wall, ' + verse + ' bottles of beer.\nTake one down and pass it around, ' + (verse - 1) + ' bottle of beer on the wall.\n');
} else if (verse === 1) {
song = ('1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n')
} else if (verse === 0) {
song = ('No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n');
} else {
song = (verse + ' bottles of beer on the wall, ' + verse + ' bottles of beer.\nTake one down and pass it around, ' + (verse - 1) + ' bottles of beer on the wall.\n');
}
return song;
}

BeerSong.prototype.sing = function (start, stop) {

var song = '';

if (stop === undefined) {

stop = 0;

while (start > 2) {
song += (start + ' bottles of beer on the wall, ' + start + ' bottles of beer.\nTake one down and pass it around, ' + (start - 1) + ' bottles of beer on the wall.\n\n');
start--;
}

if (start === 2) {
song += ('2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n')
start--;
}

if (start === 1) {
song += ('1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\n')
start--;
}

if (start === 0) {
song += ('No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n');
return song;
}

} else if (stop > 2) {

while (start > stop && stop > 2) {
song += (start + ' bottles of beer on the wall, ' + start + ' bottles of beer.\nTake one down and pass it around, ' + (start - 1) + ' bottles of beer on the wall.\n\n');
start--;
}

song = song + stop + ' bottles of beer on the wall, ' + stop + ' bottles of beer.\nTake one down and pass it around, ' + (stop - 1) + ' bottles of beer on the wall.\n'
return song;

} else {

while (start > 2) {
song += (start + ' bottles of beer on the wall, ' + start + ' bottles of beer.\nTake one down and pass it around, ' + (start - 1) + ' bottles of beer on the wall.\n\n');
start--;
}

if (start === 2) {
song += (start + ' bottles of beer on the wall, ' + start + ' bottles of beer.\nTake one down and pass it around, ' + (start - 1) + ' bottle of beer on the wall.\n');
start--;
}

if (start === 1) {
song += ('1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\n')
start--;
}

if (start === 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would start to challenge yourself to rethink how you are structuring your algorithms... when I see multiple if statements that is a red flag

song += ('No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n');
}
return song;
}
}

module.exports = BeerSong;
10 changes: 5 additions & 5 deletions exercism/beer-song/beer-song.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ describe('BeerSong', function() {
expect(song.verse(8)).toEqual(expected);
});

xit('handles 2 bottles', function() {
it('handles 2 bottles', function() {
var expected = '2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n';
expect(song.verse(2)).toEqual(expected);
});

xit('handles 1 bottle', function() {
it('handles 1 bottle', function() {
var expected = '1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n';
expect(song.verse(1)).toEqual(expected);
});

xit('handles 0 bottles', function() {
it('handles 0 bottles', function() {
var expected = 'No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n';
expect(song.verse(0)).toEqual(expected);
});

xit('sings several verses', function() {
it('sings several verses', function() {
var expected = '8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n';
expect(song.sing(8, 6)).toEqual(expected);
});

xit('sings the rest of the verses', function() {
it('sings the rest of the verses', function() {
var expected = '3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n';
expect(song.sing(3)).toEqual(expected);
});
Expand Down
23 changes: 23 additions & 0 deletions exercism/bracket-push/bracket-push.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Checks each value of string for whether it is an opening bracket or a closing bracket
// Checks that each opening bracket is matched with a closing bracket
// If any opening bracket or closing bracket does not have a matched bracket, return False
// Checks that opening bracket occurs at an earlier index than its matched closing bracket
// If not, return False
//


// Ana's notes:
// Innermost opening bracket (last to open) needs to close before any previous opening brackets
// When a bracket closes properly then its pair is checked off
// Iterate through string input
// Push opening brackets to empty array "openBrackets"



// iterate through string


function bracket(string) {


}
7 changes: 3 additions & 4 deletions exercism/diamond/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Given a letter, print a diamond starting with 'A' with the supplied letter at th

## Diamond kata

The diamond kata takes as its input a letter, and outputs it in a diamond
shape. Given a letter, it prints a diamond starting with 'A', with the
The diamond kata takes as its input a letter, and outputs it in a diamond
shape. Given a letter, it prints a diamond starting with 'A', with the
supplied letter at the widest point.

## Requirements
Expand All @@ -19,7 +19,7 @@ supplied letter at the widest point.
* The diamond has a square shape (width equals height).
* The letters form a diamond shape.
* The top half has the letters in ascending order.
* The bottom half has the letters in descending order.
* The bottom half has the letters in descending order.
* The four corners (containing the spaces) are triangles.

## Examples
Expand Down Expand Up @@ -80,4 +80,3 @@ Seb Rose [http://claysnow.co.uk/recycling-tests-in-tdd/](http://claysnow.co.uk/r

## Submitting Incomplete Problems
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

7 changes: 7 additions & 0 deletions exercism/diamond/diamond.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var Diamond = function() {}

Diamond.prototype.makeDiamond = function(letter) {

}

module.exports = Diamond;
213 changes: 213 additions & 0 deletions exercism/hamming/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
module.exports = {
"env": {
"browser": true
},
"extends": "eslint:recommended",
"rules": {
"accessor-pairs": "error",
"array-bracket-spacing": "error",
"array-callback-return": "error",
"arrow-body-style": "error",
"arrow-parens": "error",
"arrow-spacing": "error",
"block-scoped-var": "error",
"block-spacing": "error",
"brace-style": "error",
"callback-return": "error",
"camelcase": "error",
"capitalized-comments": "error",
"class-methods-use-this": "error",
"comma-dangle": "error",
"comma-spacing": "error",
"comma-style": "error",
"complexity": "error",
"computed-property-spacing": "error",
"consistent-return": "error",
"consistent-this": "error",
"curly": "error",
"default-case": "error",
"dot-location": "error",
"dot-notation": "error",
"eol-last": [
"error",
"never"
],
"eqeqeq": "error",
"func-call-spacing": "error",
"func-name-matching": "error",
"func-names": "error",
"func-style": "error",
"generator-star-spacing": "error",
"global-require": "error",
"guard-for-in": "error",
"handle-callback-err": "error",
"id-blacklist": "error",
"id-length": "error",
"id-match": "error",
"indent": "error",
"init-declarations": "error",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": "error",
"line-comment-position": "error",
"linebreak-style": "error",
"lines-around-comment": "error",
"lines-around-directive": "error",
"max-depth": "error",
"max-len": "error",
"max-lines": "error",
"max-nested-callbacks": "error",
"max-params": "error",
"max-statements": "error",
"max-statements-per-line": "error",
"multiline-ternary": "error",
"new-cap": "error",
"new-parens": "error",
"newline-after-var": "error",
"newline-before-return": "error",
"newline-per-chained-call": "error",
"no-alert": "error",
"no-array-constructor": "error",
"no-await-in-loop": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-compare-neg-zero": "error",
"no-confusing-arrow": "error",
"no-continue": "error",
"no-div-regex": "error",
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-empty-function": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-extra-parens": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-inline-comments": "error",
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-magic-numbers": "error",
"no-mixed-operators": "error",
"no-mixed-requires": "error",
"no-multi-assign": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": "error",
"no-native-reassign": "error",
"no-negated-condition": "error",
"no-negated-in-lhs": "error",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-param-reassign": "error",
"no-path-concat": "error",
"no-plusplus": "error",
"no-process-env": "error",
"no-process-exit": "error",
"no-proto": "error",
"no-prototype-builtins": "error",
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-modules": "error",
"no-restricted-properties": "error",
"no-restricted-syntax": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-sync": "error",
"no-tabs": "error",
"no-template-curly-in-string": "error",
"no-ternary": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-undefined": "error",
"no-underscore-dangle": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
"no-use-before-define": "error",
"no-useless-call": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "error",
"no-void": "error",
"no-warning-comments": "error",
"no-whitespace-before-property": "error",
"no-with": "error",
"nonblock-statement-body-position": "error",
"object-curly-newline": "error",
"object-curly-spacing": "error",
"object-property-newline": "error",
"object-shorthand": "error",
"one-var": "error",
"one-var-declaration-per-line": "error",
"operator-assignment": "error",
"operator-linebreak": "error",
"padded-blocks": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-destructuring": "error",
"prefer-numeric-literals": "error",
"prefer-promise-reject-errors": "error",
"prefer-reflect": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"quote-props": "error",
"quotes": "error",
"radix": "error",
"require-await": "error",
"require-jsdoc": "error",
"rest-spread-spacing": "error",
"semi": "error",
"semi-spacing": "error",
"sort-imports": "error",
"sort-keys": "error",
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": "error",
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": "error",
"strict": "error",
"symbol-description": "error",
"template-curly-spacing": "error",
"template-tag-spacing": "error",
"unicode-bom": [
"error",
"never"
],
"valid-jsdoc": "error",
"vars-on-top": "error",
"wrap-iife": "error",
"wrap-regex": "error",
"yield-star-spacing": "error",
"yoda": "error"
}
};
Loading