Skip to content

Instantly share code, notes, and snippets.

View jarnheimer's full-sized avatar
🥊

Viktor Jarnheimer jarnheimer

🥊
View GitHub Profile
<?php
function isWeekend($day){
if ($day == 'Saturday' || $day == 'Sunday') {
return true;
}
return false;
@jarnheimer
jarnheimer / test-fibonacci.php
Last active August 6, 2019 15:16
Refactor Fibonacci
<?php
function fibonacci(int $n)
{
if ($n < 50) {
if ($n !== 0) {
if ($n !== 1) {
return fibonacci($n - 1) + fibonacci($n - 2);
} else {
return 1;
@jarnheimer
jarnheimer / test-1.php
Last active June 16, 2020 14:24
Refactoring code test PHP
<?php
/**
* Is the bar open
*
* @return bool
*/
function isBarOpen($day)
{
if ($day) {
@jarnheimer
jarnheimer / CONTRIBUTING.md
Last active July 9, 2019 07:30
Example of CONTRIBUTING guides

Contributing to Project A

👍🎉 First off, thanks for contributing! This is an example of a contribution guide for a small project. 🎉👍

Getting started

  • Submit a GitHub Issue for your issue if one does not already exist.
    • Clearly describe the issue including steps to reproduce when it is a bug.
    • A ticket is not necessary for trivial changes.
@jarnheimer
jarnheimer / SocialSecurityNumber.php
Created July 7, 2019 12:16
Class to handle Swedish Social Security Number
<?php namespace App\Apply\Helpers;
use App\Exceptions\SwedishSocialSecurityNumberException;
use Carbon\Carbon;
use DateTime;
use Exception;
/**
* Extracts data, manipulates and validates swedish security numbers
*
@jarnheimer
jarnheimer / Developers.php
Last active March 21, 2018 13:01
Test example
<?php namespace App;
class Developers
{
function get_best_developer($type)
{
if ($type == 1) { // VueJs
$developer = 'John Smith';