Skip to content

Instantly share code, notes, and snippets.

Victor Eliasson viirre

Block or report user

Report or block viirre

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Logger.php
* We want to implement a logger
* We can have several loggers: 'bugsnag', 'sentry', 'file', 'database', 'redis'
* We want to be able to store which logger we use in our .env file
* Your job:
View test_2_dry_refactor.php
class DoesAwesomeStuff {
protected $meta = [];
protected $metaExtractor;
public function __construct($metaExtractor)
$this->metaExtractor = $metaExtractor;
viirre / test_1_testable.php
Last active Apr 10, 2018
Test #1 - make SomeService testable without actually making any https calls
View test_1_testable.php
class SomeService
public function callApi()
$apiClass = new ApiClass;
$result = $apiClass->call('fetch');
// Handle result
viirre / index.html
Last active Apr 13, 2018
Splash index for adaptive shop sites during upgrade
View index.html
<!doctype html>
<meta charset="utf-8">
<meta http-equiv="Content-language" content="sv">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Webbshop från Adaptive Shop</title>
<meta http-equiv="refresh" content="30">
<meta name="robots" content="noindex">
body {
viirre /
Last active Apr 10, 2018
Sync prod Mysql database to stage
#1. Add ssh key (stage key) to PROD machine
# 1.1 On stage:
# cat ~/.ssh/
# 1.2 On prod
# nano ~/.ssh/authorized_keys
# * paste key*
DATE=$(date +"%Y-%m-%d")
viirre / pre-push
Last active Apr 27, 2017
Pre-push git hook to avoid errors in prod
View pre-push
function allTestsShouldPass(){
echo "Running tests..."
if [ $? -ne 0 ]; then
echo " -> ERROR. Tests did not pass, fix them!"
exit 1
viirre / CodeigniterValetDriver.php
Created May 26, 2016
Valet driver for the Codeigniter framework
View CodeigniterValetDriver.php
class CodeigniterValetDriver extends ValetDriver
* Determine if the driver serves the request.
* @param string $sitePath
* @param string $siteName
* @param string $uri
viirre /
Last active Sep 29, 2017
Bash scripts for fixing some common conf stuff on newly provisioned Forge servers
# Usage:
# wget -O
# [Change script to your servers liking]
# sudo bash
if [ "$EUID" -ne 0 ] ;
then echo "Please run as root" ;
exit 1;
viirre /
Last active Sep 18, 2015
Install new certificate with SSLmate and Forge

1. Install SSLmate on the server

sudo wget -P /etc/apt/sources.list.d
sudo wget -P /etc/apt/trusted.gpg.d
sudo apt-get update
sudo apt-get install sslmate

2. Buy the certificate

viirre / nginx.conf
Created Sep 17, 2014
Basic nginx.conf for Ubuntu 12.04 64-bit, 2 CPUs, around 2 GB RAM
View nginx.conf
# nginx Configuration File
# Run as a less privileged user for security reasons.
user www-data www-data;
# How many worker threads to run;
# "auto" sets it to the number of CPU cores available in the system, and
# offers the best performance. Don't set it higher than the number of CPU
# cores if changing this parameter.
You can’t perform that action at this time.