Created
March 14, 2022 18:18
-
-
Save prezine/caf255c24979e28f2e1134f9ac08e5cf to your computer and use it in GitHub Desktop.
BCM Developer Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shuffle(array) { | |
let currentIndex = array.length, randomIndex; | |
// While there remain elements to shuffle... | |
while (currentIndex != 0) { | |
// Pick a remaining element... | |
randomIndex = Math.floor(Math.random() * currentIndex); | |
currentIndex--; | |
// And swap it with the current element. | |
[array[currentIndex], array[randomIndex]] = [ | |
array[randomIndex], array[currentIndex]]; | |
} | |
return array; | |
} | |
$(document).ready(function() { | |
$('button').after('<button id="hider">Hide button</button>') | |
}) | |
$(document).on('click', '#hider', function (e) { | |
e.preventDefault() | |
$('body p').find('img').toggle() | |
}) | |
$("button").on('click', function(e){ | |
e.preventDefault() | |
var p1 = $('body p').eq(0).html() | |
var p2 = $('body p').eq(1).html() | |
var p3 = $('body p').eq(2).html() | |
var arrayp = [p1,p2,p3] | |
arrayp = shuffle(arrayp) | |
$('body').append(`<hr> <p> ${arrayp[0]} </p> <p> ${arrayp[1]} </p>`) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrapper"> | |
<div class="row">A</div> | |
<div class="row">B</div> | |
<div class="row">C</div> | |
<div class="row">D</div> | |
<div class="row">E</div> | |
<div class="row">F</div> | |
<div class="row">G</div> | |
<div class="row">H</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The fix was that; | |
* I added "}" (important) - line 24 | |
* and closed the opened php tag "?>" (optional) - line 25 | |
* comment out "handlertoreplacewithlivead" since it might not be a constant just a placeholder - line 20 | |
*/ | |
<?php | |
$page = $_GET['page'] ?? 1; | |
$q = WP_Query(['posts_per_page' => 10, 'page' => $page, 's' => $_GET['s']]); | |
?> | |
<h1>Page <?=$page ?> of <?=$pages ?> : Search for <?=esc_html($_GET['s'])?> | |
<?php | |
while ($q->have_posts()) | |
{ | |
$q->the_post(); | |
$content = get_the_content(); | |
$content = preg_replace_callback('#[ad]#', function () | |
{ | |
echo '<div class="ad ad-' . $m[1] . '"></div>'; # leave for Javascript | |
// handlertoreplacewithlivead | |
}); | |
?> | |
<h2><?=esc_html(the_title()) ?></h2> | |
<p><?php echo $content ?></p> | |
<?php | |
} // close php's opening tag | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.wrapper { | |
display: grid; | |
grid-template-columns: repeat(3, 1fr); | |
gap: 10px; | |
grid-auto-rows: minmax(100px, auto); | |
} | |
.row:nth-child(1) { | |
grid-column: 1/3; | |
grid-row: 1; | |
} | |
.row:nth-child(2) { | |
grid-column: 3; | |
grid-row: 1; | |
} | |
.row:nth-child(3) { | |
grid-column: 1; | |
grid-row: 2; | |
} | |
.row:nth-child(4) { | |
grid-column: 2; | |
grid-row: 2; | |
} | |
.row:nth-child(5) { | |
grid-column: 3; | |
grid-row: 2; | |
} | |
.row:nth-child(6) { | |
grid-column: 1; | |
grid-row: 3; | |
} | |
.row:nth-child(7) { | |
grid-column: 2; | |
grid-row: 3; | |
} | |
.row:nth-child(8) { | |
grid-column: 3; | |
grid-row: 3; | |
} | |
@media only screen and (max-width: 600px) { | |
.row:nth-child(1) { | |
grid-column: 1/4; | |
grid-row: 1; | |
} | |
.row:nth-child(2) { | |
grid-column: 1/4; | |
grid-row: 2; | |
} | |
.row:nth-child(3) { | |
grid-column: 1/4; | |
grid-row: 3; | |
} | |
.row:nth-child(4) { | |
grid-column: 1/4; | |
grid-row: 4; | |
} | |
.row:nth-child(5) { | |
grid-column: 1/4; | |
grid-row: 5; | |
} | |
.row:nth-child(6) { | |
grid-column: 1/4; | |
grid-row: 6; | |
} | |
.row:nth-child(7) { | |
grid-column: 1/4; | |
grid-row: 7; | |
} | |
.row:nth-child(8) { | |
grid-column: 1/4; | |
grid-row: 8; | |
} | |
} | |
div:not(#wrapper) { | |
background-color: #C9C9C9; | |
border: 1px solid #000; | |
padding: 30px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Example</title> | |
</head> | |
</html> | |
<body> | |
<h1>Hello, world</h1> | |
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Cras mattis consectetur purus sit amet fermentum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros</p> | |
<p>Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Donec sed odio dui. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p> | |
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia <a href=https://www.bigcabal.com> odio sem nec | |
elit. Sed posuere </a > consectetur est at <abbr | |
name="lobortis">lbrt</abbr>. Maecenas faucibus mollis interdum. Aenean | |
lacinia <img src=test.jpeg with=300 height=auto> bibendum | |
nulla sed consectetur. Praesent <code><b>commodo cursus magna, vel | |
scelerisque nisl consectetur et.</code></b></p> | |
<button>Hit me</button> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment