diff --git a/challenges/THE BOX/box.css b/challenges/THE BOX/box.css new file mode 100644 index 0000000..5a78aa6 --- /dev/null +++ b/challenges/THE BOX/box.css @@ -0,0 +1,26 @@ +#content-holder{ + width:560px; + margin:25px auto; + border:2px solid rgba(200,200,200,0.7); + padding:5px; +} + +#content-holder div div{ + margin:5px; +} + +#top-row{ + height:410px; +} + +#bottom-row{ + height:110px; +} + +#top-row div{ + float:right; +} + +#bottom-row div{ + float:left; +} \ No newline at end of file diff --git a/challenges/THE BOX/boxes.html b/challenges/THE BOX/boxes.html new file mode 100644 index 0000000..6f8921b --- /dev/null +++ b/challenges/THE BOX/boxes.html @@ -0,0 +1,24 @@ + + + + Box Challenge + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/challenges/THE BOX/boxes.js b/challenges/THE BOX/boxes.js new file mode 100644 index 0000000..9ba1ced --- /dev/null +++ b/challenges/THE BOX/boxes.js @@ -0,0 +1,24 @@ +"use strict" + +// Gets the colors of a clicked element (split into rgb) and inverts them +function invertColor(element){ + var colors = splitColors($(element).css("background-color")); + $(element).css("background-color", "rgb(" + (255 - colors[0]) + ',' + (255 - colors[1]) + ',' + (255 - colors[2]) + ")"); +} + +// Takes the color attribute of an element in, +// Uses a loop to iterate through all the colors and place them into an array +function splitColors(colors){ + var to_return = []; + var start = 4; + for(var i = 0; i < 3; i++){ + var end = colors.indexOf(",", start + 1); + // To account for the final color not having a comma after it. + if(end == -1){ + end = colors.length-1; + } + to_return[i] = colors.substring(start, end); + start = end + 1; + } + return to_return; +} \ No newline at end of file diff --git a/challenges/comprehension/explanation.txt b/challenges/comprehension/explanation.txt index e69de29..1a3128d 100755 --- a/challenges/comprehension/explanation.txt +++ b/challenges/comprehension/explanation.txt @@ -0,0 +1,7 @@ +SYMBOLS +@ represents a dictionary +$ represents an array +% represents a string + +OVERVIEW +First the program declares a new empty dictionary. Then in a loop, read in a text file into the string temp one line at a time. For each line: separate the line by spaces, putting the result of the split into an array. For each word (string) in the array, check if the word contains only English alphabetical and numerical characters. If it does, check if the dictionary contains a reference to the word. If so, increment the value associated with the word by one; else, add the word to the dictionary with the value one. diff --git a/challenges/strpos/strpos.php b/challenges/strpos/strpos.php old mode 100755 new mode 100644 index ee1c4b1..93ea3ab --- a/challenges/strpos/strpos.php +++ b/challenges/strpos/strpos.php @@ -1,8 +1,32 @@ \ No newline at end of file