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
14 changes: 14 additions & 0 deletions challenges/THE BOX/bootstrap.min.css

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions challenges/THE BOX/bootstrap.min.js

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions challenges/THE BOX/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
body {
margin:10px;
padding: 0;
}
.container {
-webkit-box-shadow: 0px 0px 3px 0px rgba(0,0,0,0.7);
-moz-box-shadow: 0px 0px 3px 0px rgba(0,0,0,0.7);
box-shadow: 0px 0px 3px 0px rgba(0,0,0,0.7);
/*width: 570px;*/
}
.box {
width: 100%;
margin: 0;
padding: 0;
}
.row { margin: 10px 0; }
.pseudo-row { margin-top: 10px; }
.box-1 { background-color: #68884b; height: 195px; }
.box-2 { background-color: #f1ab3c; height: 400px; }
.box-3 { background-color: #81bb4d; height: 195px; }
.box-4 { background-color: #2669a8; height: 90px; }
.box-5 { background-color: #4794dc; height: 90px; }
.box-6 { background-color: #87bff4; height: 40px; }
.box-7 { background-color: #b6dbfe; height: 40px; }

img {margin: 0 auto; padding: 0; border: 0; display: block;}
41 changes: 41 additions & 0 deletions challenges/THE BOX/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<html>
<head>
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="custom.css">
<script src="jquery-3.1.1.min.js"></script>
<script src="bootstrap.min.js"></script>
</head>

<body>

<div class="container">
<div class="row">
<div class="col-xs-15">
<div class="box box-1"></div>
<div class="box box-3 pseudo-row"></div>
</div>
<div class="col-xs-40">
<div class="box box-2"></div>
</div>
</div>
<div class="row">
<div class="col-xs-30">
<div class="box box-4"></div>
</div>
<div class="col-xs-10">
<div class="box box-5"></div>
</div>
<div class="col-xs-15">
<div class="box box-6"></div>
<div class="box box-7 pseudo-row"></div>
</div>
</div>
</div>

<br>

<img src="BOX-TEST-LAYOUT.png" />

</body>

</html>
4 changes: 4 additions & 0 deletions challenges/THE BOX/jquery-3.1.1.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions challenges/comprehension/explanation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
I had a blow by blow breakdown but here's the tl:dr version...

This program reads a text file and prints out a list of every alphanumeric character it finds, along with how many times that character appears.

% = variables (strings in this case)
$ = array (of strings in this case)
@ = associative array (of string keys and an integer value in this case)
40 changes: 38 additions & 2 deletions challenges/strpos/strpos.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
<?php

function my_strpos(/* arguments go here! */)
function my_strpos($haystack, $needle, $offset = 0)
{
# Your code goes here!

//make sure the haystack is a string and build an index for it
$haystack = (string) $haystack;
$haystack_index = str_split($haystack);

//if needle isn't a string, convert it to an integer and use the corresponding ascii character, then build an index for it
if (!is_string($needle)) $needle = chr(intval($needle));
$needle_index = str_split($needle);

//if the offset is negative, find the positive offset from the end of the string
if(intval($offset) < 0) $offset = strlen($haystack) - 1 + $offset;
//if the negative offset was longer than the haystack, just start at the beginning (php.net entry unclear on this edge case)
if ($offset < 0 ) $offset = 0;

$possible_match_needle_index = 0;
$possible_match_haystack_start = 0;

foreach ($haystack_index as $haystack_key => $haystack_value)
{
//make sure the offset has been reached and check for a match
if ($haystack_key >= $offset && $needle_index[$possible_match_needle_index] == $haystack_value )
{
$possible_match_needle_index++;
//store the haystack position if you get a possible match
if ($possible_match_needle_index == 1) $possible_match_haystack_start = $haystack_key;
}
else
{
//the match failed so reset the needle index to check
$possible_match_needle_index = 0;
}
//if the entire needle matched, return the haystack start position
if ($possible_match_needle_index == strlen($needle)) return $possible_match_haystack_start;
}

//if a match wasn't found, return false
return false;
}

$alphabet = 'abcdefghijklmnopqrstuvwxyz';
Expand Down