Skip to content

Instantly share code, notes, and snippets.


Sébastien Nikolaou sebdesign

View GitHub Profile
laracasts / modal.blade.php
Last active Jun 8, 2021
Modals with Zero JavaScript
View modal.blade.php
<div id="{{ $name }}" class="overlay">
<a href="#" class="cancel"></a>
<div class="modal">
{{ $slot }}
<a href="#" class="close">&times;</a>
laravel-shift / .php_cs.laravel.php
Last active Jun 25, 2021
PHP CS Fixer - Laravel Coding Style Ruleset
View .php_cs.laravel.php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null]
View minimal-analytics-snippet.js
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
poul-kg / valet.conf
Last active Jun 10, 2021
CORS Rules for Laravel Valet Nginx
View valet.conf
# To enable CORS you should add lines with CORS rules below to your valet.conf file
# Find the file /usr/local/etc/nginx/valet/valet.conf - this is Valet conf for Nginx
# of try to execute `locate valet.conf` and find the `valet.coinf` in `nginx` subdirectory
# after you edit your valet.conf do not forget to execute `valet restart`
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
egmontkob /
Last active Jun 25, 2021
Hyperlinks in Terminal Emulators
iben12 /
Last active May 22, 2021
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

andreibosco /
Last active Jun 14, 2021
disable creative cloud startup on mac
View owl.linked.js
* Plugin for linking multiple owl instances
* @version 1.0.0
* @author David Deutsch
* @license The MIT License (MIT)
;(function($, window, document, undefined) {
* Creates the Linked plugin.
View seeIsNotSoftDeletedInDatabase.php
* Assert that a given where condition does not matches a soft deleted record
* @param string $table
* @param array $data
* @param string $connection
* @return $this
protected function seeIsNotSoftDeletedInDatabase($table, array $data, $connection = null)
rtconner / SftpServiceProvider.php
Last active May 28, 2021
Provider so you can add a 'sftp' connection in Laravel 5 filesystems.php - "Call to undefined method League\Flysystem\Filesystem::createSftpDriver"
View SftpServiceProvider.php
namespace App\Providers;
use League\Flysystem\Sftp\SftpAdapter;
use Storage;
use League\Flysystem\Filesystem;
use Illuminate\Support\ServiceProvider;