Skip to content

Instantly share code, notes, and snippets.

View mpskovvang's full-sized avatar

Martin Skovvang Petersen mpskovvang

View GitHub Profile
@mpskovvang
mpskovvang / LineChart.php
Created November 25, 2021 22:22
Laravel Livewire with Chart.js
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class LineChart extends Component
{
public $data;
@mpskovvang
mpskovvang / ExponentialBackoffHelper.php
Created October 9, 2017 12:04
At [Katoni](https://www.katoni.dk) we needed a way to handle failed messages and made this simple exponential backoff helper. Inspiration by [alphasights/sneakers_handlers](https://github.com/alphasights/sneakers_handlers/blob/8a9a61407e4010e08b621d68adf81b0c212e1ef5/lib/sneakers_handlers/exponential_backoff_handler.rb).
<?php
use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Message\AMQPMessage;
class ExponentialBackoffHelper
{
/**
* @var AMQPChannel
*/
private $channel;
@mpskovvang
mpskovvang / ExponentialBackoffHelper.php
Created October 9, 2017 11:52
An RabbitMQ exponential backoff helper for failed messages.
<?php
use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Message\AMQPMessage;
class ExponentialBackoffHelper
{
/**
* @var AMQPChannel
*/
private $channel;
@mpskovvang
mpskovvang / php5-with-pthreads
Last active April 9, 2016 13:51
PHP Pthreads installation Debian
#Get php5 source:
apt-get source php5
#Edit debian/rules
#add --enable-roxen-zts and/or --enable-maintainer-zts and/or --enable-pthreads to COMMON_CONFIG
#Install build dependencies:
sudo apt-get build-dep php5
#From directory where package source were extracted run:
@mpskovvang
mpskovvang / vhost.sh
Last active August 29, 2015 14:16 — forked from mattmezza/vhost.sh
#!/bin/bash
# This script is used for create virtual hosts on CentOs.
# Created by alexnogard from http://alexnogard.com
# Improved by mattmezza from http://you.canmakethat.com
# Feel free to modify it
# PARAMETERS
#
# $usr - User
# $dir - directory of web files
# $servn - webserver address without www.