Skip to content

Instantly share code, notes, and snippets.

View nicolaskempf57's full-sized avatar

Nicolas KEMPF nicolaskempf57

View GitHub Profile
@nicolaskempf57
nicolaskempf57 / message.php
Created April 27, 2015 10:36
smsGateway : send sms to all contacts ( https://smsgateway.me/ )
<?php
include "smsGateway.php";
$smsGateway = new SmsGateway('ADRESSE_EMAIL', 'MOT_DE_PASSE');
$deviceID= IDENTIFIANT_DE_L_APPAREIL;
$contacts = $smsGateway->getContacts();
$arrayContacts=array();
foreach($contacts["response"]["result"]["data"] as $contact) {
$arrayContacts[]=$contact["id"];
}
$smsGateway->sendMessageToContact($arrayContacts, $message, $deviceID);
@nicolaskempf57
nicolaskempf57 / npm_sans_sudo.sh
Created May 14, 2015 12:17
Pour résoudre le problème qui empêche d'utiliser npm sans sudo
sudo chown -R $(whoami) ~/.npm
@nicolaskempf57
nicolaskempf57 / Authenticate.php
Created October 3, 2015 20:47
Authenticate Middleware for Lumen based on the Laravel one
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
class Authenticate
{
/**
[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
<?php
public function paths() {
$paths_list = array();
$simple_path = $this->check_same_path($this->depart, $this->arrivee);
if ($simple_path) {
$paths_list = $this->simple_paths($simple_path);
}
if (!$simple_path || !$paths_list) {
$paths_list = $this->complex_paths();
}
php artisan make:middleware CheckAge
@nicolaskempf57
nicolaskempf57 / CheckAge.php
Last active May 8, 2020 13:19
CheckAge Middleware for my blog post on Laravel Middleware https://medium.com/blog-justenico/laravel-les-middlewares-59b651d80b10
<?php
namespace App\Http\Middleware;
use Closure;
class CheckAge
{
/**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure $next
<?php
namespace App\Http\Middleware;
use Closure;
class CheckRole
{
 /**
 * Handle the incoming request.
 *
 * @param \Illuminate\Http\Request $request
 * @param \Closure $next
@nicolaskempf57
nicolaskempf57 / routeWithMiddleware.php
Last active May 8, 2020 13:25
Example route with middleware for my blog post on Laravel Middleware https://medium.com/blog-justenico/laravel-les-middlewares-59b651d80b10
<?php
Route::get('admin/profile', "MonController@fonction")->middleware('auth');
@nicolaskempf57
nicolaskempf57 / routeWithMiddlewareClass.php
Last active May 8, 2020 13:25
Example route with middleware for my blog post on Laravel Middleware https://medium.com/blog-justenico/laravel-les-middlewares-59b651d80b10
<?php
Route::get('admin/profile', "MonController@fonction")->middleware(CheckAge::class);