Skip to content

Instantly share code, notes, and snippets.

View sebastiaanluca's full-sized avatar
👋

Sebastiaan Luca sebastiaanluca

👋
View GitHub Profile
<?php
namespace Tests;
use PHPUnit\Framework\TestCase;
class MyTest extends TestCase
{
public function test_it_does_something()
{
<?php
namespace App\Mail;
use Illuminate\Container\Container;
use Illuminate\Mail\Mailable as BaseMailable;
use PHPUnit\Framework\Assert;
class Mailable extends BaseMailable
{
@sebastiaanluca
sebastiaanluca / vhost.ini
Created January 10, 2017 00:10
nginx virtual host configuration file where `[::]` handles IPv6 IPs.
# Redirect non-secure http requests to secure https domain
# Redirect non-www requests to www.site.com
server {
listen 0.0.0.0:80;
listen [::]:80;
listen 0.0.0.0:443 ssl http2;
listen [::]:443 ssl http2;
server_name domain.com *.domain.com;
@sebastiaanluca
sebastiaanluca / NewMessage.php
Last active April 11, 2024 12:36
Laravel + Redis + NodeJS + Socket.io pub/sub secure server and client supporting multiple rooms, channels, users, … Add `client.js` to your client app, run `node server.js`, and trigger the Laravel event any way you want to broadcast the data.
<?php
namespace App\Events;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
class NewMessage extends Event implements ShouldBroadcast
{
var Moment = require('moment');
var Schedule = require('node-schedule');
var subCounter;
//
// Schedule the jobs
console.log('Setting up jobs');
@sebastiaanluca
sebastiaanluca / jobs.js
Last active December 6, 2015 21:03
Triggers an alarm every hour at 10 minutes, a sub job every minute after that for about 10 minutes, and a snooze at 30 minutes.
var Moment = require('moment');
var Schedule = require('node-schedule');
var alarmJob;
var fixedSnoozeJob;
var subCounter;
//
@sebastiaanluca
sebastiaanluca / AbstractRepository.php
Last active September 15, 2017 15:42
Simple example of returning a generic object in a repository using Laravel.
<?php namespace App\Repositories;
use App;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Collection;
use Illuminate\Support\Contracts\ArrayableInterface;
abstract class AbstractRepository
{