Skip to content

Instantly share code, notes, and snippets.

View jarnheimer's full-sized avatar
🥊

Viktor Jarnheimer jarnheimer

🥊
View GitHub Profile
@jarnheimer
jarnheimer / export-pull-request.md
Last active October 4, 2024 14:04
Guide on how to export a pull request to a file

Export pull request

GitHub

Save a pull request as a pr.diff

curl -H "Accept: application/vnd.github.v3.diff" -u [username]:[personal_access_token] https://api.github.com/repos/[organization]/[repo]/pulls/[pull id] > pr.diff 

Replace

  • username your Github username
<?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';