Skip to content

Instantly share code, notes, and snippets.

View doulmi's full-sized avatar

CHEN Fengyu doulmi

  • French
View GitHub Profile
@doulmi
doulmi / CheckForMaintenanceMode.php
Created March 15, 2017 11:21
Maintenance mode, but server and ip in whiteliste can access
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Foundation\Application;
use Symfony\Component\HttpKernel\Exception\HttpException;
class CheckForMaintenanceMode
{
@doulmi
doulmi / ImageUtils.php
Created March 9, 2017 08:56
ImageUtils
<?php
namespace App;
use Exception;
class ImageUtils
{
public static $_JPG = "jpg";
public static $_PNG = "png";
@doulmi
doulmi / LaravelXSS.php
Created February 24, 2017 08:36
Protect from form input XSS attack
public static function stripXSS()
{
$sanitized = static::cleanArray(Input::get());
Input::merge($sanitized);
}
public static function cleanArray($array)
{
$result = array();
foreach ($array as $key => $value) {
@doulmi
doulmi / BootstrapBtnBlank.css
Last active January 4, 2017 10:52
Bootstrap button not be blank when hover
.btn:focus, .btn.focus, .btn:active:focus, .btn:active.focus, .btn.active:focus, .btn.active.focus {
color: white;
}
&:focus, &.focus, &:active:focus, &:active.focus, &.active:focus, &.active.focus {
color: white;
}
@doulmi
doulmi / LaravelNavbarActive.php
Created January 4, 2017 09:50
Laravel Navbar active
//Helper
/**
* Determine if this <li> is active
* return 'active' or ''
*/
public static function activeLi($routes)
{
if (is_string($routes)) {
return Route::currentRouteNamed($routes) ? 'active' : '';
} elseif (is_array($routes)) {