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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions challenges/THE BOX/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>THE BOX</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="orange"></div>
<div id="dark_green"></div>
<div id="light_green"></div>
<div id="dark_blue"></div>
<div id="medium_dark_blue"></div>
<div id="medium_light_blue"></div>
<div id="light_blue"></div>

</body>
</html>
56 changes: 56 additions & 0 deletions challenges/THE BOX/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
div {
position: absolute;
}

#orange {
background-color: #F1AB3c;
width: 400px;
height: 400px;
left: 160px;
top: 10px;
}

#dark_green {
background-color: #68884b;
width: 140px;
height: 190px;
top: 10px;
}

#light_green {
background-color: #7fBB4d;
width: 140px;
height: 190px;
top: 220px;
}

#dark_blue {
background-color: #2669A4;
width: 290px;
height: 90px;
top: 420px;
}

#medium_dark_blue {
background-color: #4994DC;
width: 90px;
height: 90px;
left: 310px;
top: 420px;
}

#medium_light_blue {
background-color: #87BFF4;
width: 150px;
height: 40px;
top: 420px;
left: 410px;
}

#light_blue {
background-color: #B6DBFE;
width: 150px;
height: 40px;
top: 470px;
left: 410px;
}
13 changes: 13 additions & 0 deletions challenges/comprehension/explanation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

@ defines an array or list or something of that nature

% defines a variable

$ defines an array or something

The while loop takes a line from a text file and splits it by " " into an array.
Then the for each takes a chunk from that array and checks if it matches some string or regexp ( I have never used regexp's). If a match exists it then puts the chunk into an array or stack called storage. If a match does not exist it just shoves it into the second slot in the array assuming it starts at 0.

The for each at the bottom prints the index and chunk from the array in storage with some pretty printing.


49 changes: 47 additions & 2 deletions challenges/strpos/strpos.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
<?php

function my_strpos(/* arguments go here! */)
function my_strpos($whole_string, $chunk_string, $position_check=false)
{
# Your code goes here!
$chunk_string_char_array = str_split($chunk_string);
$whole_string_array = str_split($whole_string);

if ($position_check !== false) { // This works and checks out
if ($chunk_string_char_array[0] == $whole_string_array[$position_check]) {
return true;
}
return false;
}

$count = count($chunk_string_char_array);
$array_position = 0;
$whole_position = 0;

foreach ($whole_string_array as $character) { //Go through the alphabet
if ($character == $chunk_string_char_array[0]) { //Check the first character

if ($count > 1) { // If array is larger than one char
$whole_peek = 1;
$still_matching = true;

for ($chunk_index=1; $chunk_index < $count && $array_position + $whole_peek < count($whole_string_array); $chunk_index++,$whole_peek++) {
if ($chunk_string_char_array[$chunk_index] != $whole_string_array[$array_position + $whole_peek]) {
$still_matching = false;
continue;
}
}
if ($still_matching) {
return $array_position;
}

} else {
return $array_position;
}

}
$array_position++;
$whole_position++;
}
return false;
}

$alphabet = 'abcdefghijklmnopqrstuvwxyz';
Expand All @@ -13,6 +52,12 @@ function my_strpos(/* arguments go here! */)
# Should print "6"
print(my_strpos($alphabet, 'ghi') . "\n");

print(my_strpos($alphabet, 'gh!') . "\n");
print(my_strpos($alphabet, 'g!i') . "\n");

var_dump(my_strpos($alphabet, 'a', 0));


# Should print "bool(false)"
var_dump(my_strpos($alphabet, 'u', 22));

Expand Down