Skip to content

Instantly share code, notes, and snippets.

View fokosun's full-sized avatar
:octocat:
I may be slow to respond.

fokosun fokosun

:octocat:
I may be slow to respond.
View GitHub Profile
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 {
<?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];
@fokosun
fokosun / fizzbuzz.go
Created September 11, 2023 14:53
coding exercise
package main
import "fmt"
func main() {
fmt.Println("fizz buzz game for developers!")
for n := 1; n <= 20; n++ {
if n%15 == 0 {
@fokosun
fokosun / e2e-tests.yml
Created July 28, 2023 03:06 — forked from stfsy/e2e-tests.yml
Simple opinionated GitHub Actions workflow for end-to-end testing of Vue.js with TailwindCSS
name: e2e-tests
on: push
jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
@fokosun
fokosun / index.js
Created January 11, 2023 19:45 — forked from ismailbaskin/index.js
GCP Pub/Sub to Slack message Cloud Function
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',
@fokosun
fokosun / ThrottleRequests.php
Created December 10, 2020 20:38 — forked from developerdino/ThrottleRequests.php
Lumen Middleware for rate limiting - based on Laravel's implementation.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
use Illuminate\Cache\RateLimiter;
class ThrottleRequests
{
@fokosun
fokosun / sum_closest_to_target
Created July 27, 2020 17:30
Write a function that returns a pair of numbers from the 2 arrays whose sum is the closest to the target
<!-- 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]] -->
@fokosun
fokosun / watermelon-challenge.php
Last active August 26, 2019 16:53
watermelon challenge
<?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) {
<?php
// 26-March-2001
// 15-August-2001
// Wednesday
// 1-January-2000
// 22-February-2000
// Monday
@fokosun
fokosun / php-calling-class-test.php
Created July 9, 2019 15:25 — forked from hamstar/php-calling-class-test.php
A function that will return the calling class to the class using it
/***********************************************************
******* SIMPLE TEST **/
class A {
function t() {
echo get_calling_class();
}
}
class B {