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
<?php | |
// This solution does not care for $n <= 1 | |
function displayCheckerBoard($n): string { | |
$gridStartWithX = 'XY'; | |
$gridStartWithY = 'YX'; | |
if ($n === 2) { | |
return $gridStartWithX . PHP_EOL . $gridStartWithY . PHP_EOL; | |
} |
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
<?php | |
namespace App\Http\Controllers; | |
use App\Dtos\HealthChecksDto; | |
use Illuminate\Http\JsonResponse; | |
use Spatie\CpuLoadHealthCheck\CpuLoadCheck; | |
use Spatie\Health\Checks\Checks\UsedDiskSpaceCheck; | |
use Spatie\Health\Checks\Result; | |
use Spatie\Health\Health; |
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
package main | |
import "fmt" | |
func main() { | |
values := []int{10, 5, 23, 54, 99} | |
minimum, maximum := values[0], values[0] | |
for _, value := range values[1:] { | |
if value > maximum { |
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
<?php | |
$nums = [10, 5, 253, 54, 4]; | |
$max = $nums[0]; | |
$min = $nums[0]; | |
$count = count($nums) - 1; | |
foreach(range(0, $count) as $i) { | |
if ($nums[$i] > $max) { | |
$max = $nums[$i]; |
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
package main | |
import "fmt" | |
func main() { | |
fmt.Println("fizz buzz game for developers!") | |
for n := 1; n <= 20; n++ { | |
if n%15 == 0 { |
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
name: e2e-tests | |
on: push | |
jobs: | |
build: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] |
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
const https = require('https'); | |
const url = require('url'); | |
const slackWebhookURL = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'; // CHANGE ME PLZ! | |
exports.gceAudit = (event, callback) => { | |
const msg = JSON.parse(Buffer.from(event.data.data, 'base64').toString()); | |
const slackRequest = https.request({ | |
hostname: url.parse(slackWebhookURL).hostname, | |
method: 'POST', |
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
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Response; | |
use Illuminate\Cache\RateLimiter; | |
class ThrottleRequests | |
{ |
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
<!-- Given: two integer arrsya and a target which is just a number. | |
Write a function that returns a pair of numbers from the 2 arrays whose sum is the closest to the target | |
e.g ([-1, 3, 8, 2, 9, 5], [4, 1, 2, 10, 5, 20], 24)) | |
should return [[3, 20], [5, 20]] --> |
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
<?php | |
/* | |
* ROOM FOR IMPROVEMENT | |
* both halves have to be divisible by 2 | |
*/ | |
function watermelon($n) { | |
$ans = array(); | |
if(is_integer($n)) { | |
$parts = range(1, ($n - 1)); | |
foreach($parts as $part) { |
NewerOlder