From cd1a99fc9e9ad73053e74961a9c4f01326750346 Mon Sep 17 00:00:00 2001 From: Ben Greene Date: Wed, 6 Apr 2016 16:32:44 -0700 Subject: [PATCH 1/3] completed strpos --- challenges/strpos/strpos.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) mode change 100755 => 100644 challenges/strpos/strpos.php 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 From 8c10e6bb7cc3f75c0bb1fca667d1ee199b903c31 Mon Sep 17 00:00:00 2001 From: Ben Greene Date: Wed, 6 Apr 2016 16:42:04 -0700 Subject: [PATCH 2/3] merging box --- challenges/THE BOX/box.css | 26 ++++++++++++++++++++++++++ challenges/THE BOX/boxes.html | 24 ++++++++++++++++++++++++ challenges/THE BOX/boxes.js | 24 ++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 challenges/THE BOX/box.css create mode 100644 challenges/THE BOX/boxes.html create mode 100644 challenges/THE BOX/boxes.js 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 From 44c3ca0eca24b02839bab527e2fd7c7027f7554b Mon Sep 17 00:00:00 2001 From: Ben Greene Date: Wed, 6 Apr 2016 16:43:21 -0700 Subject: [PATCH 3/3] merging comprehension --- challenges/comprehension/explanation.txt | 7 +++++++ 1 file changed, 7 insertions(+) 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.