This file contains hidden or 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
<?php | |
function benchmark(Callable $fn, ...$args) { | |
$start = microtime(true); | |
for ($i = 0; $i <= 23005; $i++) { | |
$fn(...$args); | |
} | |
$end = microtime(true); | |
$diff = ($end - $start); |
This file contains hidden or 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
/* | |
== Results: == | |
1. Loop over string | |
2. Regex | |
3. .split() | |
== Output: == | |
Regex |
This file contains hidden or 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
// Disclaimer: | |
// This is not made to show off coding skills, but rather to give people an idea how you could simulate the Game of 100 or | |
// similar instances. If you don't know, what this is, refer to https://www.youtube.com/watch?v=kOnEEeHZp94 (Vsauce2) and/or | |
// https://www.youtube.com/watch?v=C5-I0bAuEUE (minutephysics) | |
// Helper for shuffling an array | |
Array.prototype.shuffle=function(){let t,h,r=this.length;if(0===r)return this;for(;--r;)t=Math.floor(Math.random()*(r+1)),h=this[r],this[r]=this[t],this[t]=h;return this}; | |
// Helper for creating a fixed number of somethings with a range from 0 to count | |
let makeCollection = (count) => [...new Array(count)].map((x, i) => i) |
This file contains hidden or 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
<a class="sweet-modal-trigger">Open SweetModal</a> |
This file contains hidden or 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
<?php | |
namespace Adepto\Asgard\API; | |
use Adepto\Asgard\Common\PaginatedResults; | |
use Purl\Url; | |
use Psr\Http\Message\ServerRequestInterface; | |
/** | |
* Represents a request on a paginated result set. |
This file contains hidden or 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
<template> | |
<ul class="sweet-pagination" v-if="pages > 1"> | |
<li :class="[{hidden: currentPage <= 2}]"> | |
<a href="#" v-on:click.prevent="onChange(1)" class="prev">‹‹</a> | |
</li> | |
<li :class="[{hidden: currentPage <= 1}]"> | |
<a href="#" v-on:click.prevent="onChange('previous')" class="prev">‹</a> | |
</li> |