Skip to content

Instantly share code, notes, and snippets.

@grandmanitou
grandmanitou / gist:a3ecfe60e32f2f6daf1c02894f7289a2
Last active September 26, 2019 21:32
Install Imagick extension with homebred PHP 7.3
1. Run the following commands:
brew install imagemagick
brew install pkg-config
pecl install imagick
PECL will tell at the end where is your extension
Build process completed successfully
Installing '/usr/local/Cellar/php/7.3.9_1/include/php/ext/imagick/php_imagick_shared.h'
@grandmanitou
grandmanitou / gist:3cd5b7ec8fe1d715bb322d58e915e732
Created September 25, 2019 19:56
Install Imagick extension with homebred PHP 7.3
1. Run the following commands:
brew install imagemagick
brew install pkg-config
pecl install imagick
PECL will tell at the end where is your extension
2. Use this command to edit your php.ini (path may change due to your configuration)
nano /usr/local/etc/php/7.3/php.ini
@grandmanitou
grandmanitou / page.htm
Last active May 27, 2019 16:08
Embed a YouTube video in a Bootstrap 4 modal
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p class="mb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque nam asperiores adipisci, iste reiciendis ullam! Nobis eos optio voluptates illum debitis ex libero cupiditate voluptatum, provident, atque eligendi asperiores dicta!. <a href="#" data-video-src="https://www.youtube.com/embed/kQRviCE6KpM" data-toggle="modal" data-target="#videoModal">Play video</a></p>
@grandmanitou
grandmanitou / custom.js
Created May 23, 2019 14:22
Valider une date au format JJ/MM/AAAA HH:MM avec jQuery validate 1.19.x
// include moment.js
// jquery
// jquery validation
$.validator.addMethod("dateFr", function(value, element) {
return this.optional(element) || moment(value, "DD/MM/YYYY", true).isValid(); ;
}, "Veuillez saisir une date valide au format JJ/MM/AAAA");
$.validator.addMethod("dateTimeFr", function(value, element) {
return this.optional(element) || moment(value, "DD/MM/YYYY HH:mm", true).isValid(); ;
@grandmanitou
grandmanitou / page.html
Created May 21, 2019 08:01
Parse all dates in html tags and convert them into translated relative dates using moment.js
<!-- Datetime in iso8601 format -->
Publié <span class="timeago" data-time="2019-05-20T17:54:05+02:00"></span>
// Put this near the top of your resources\assets\js\app.js file.
import $ from 'jquery';
window.jQuery = $;
window.$ = $;
// Source:
// https://github.com/webpack/webpack/issues/4258#issuecomment-340240162
@grandmanitou
grandmanitou / RegistrationController.php
Created April 1, 2019 12:14
Laravel conditional eloquent condition
<?php
$registrations = Registration::whereDate('created_at', $day)->when($advisor, function($query, $advisor) {
return $query->where('conseiller', $advisor);
})->get();
?>
@grandmanitou
grandmanitou / ChartController.php
Last active April 1, 2019 10:14
Laravel conditional validation
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use App\Http\Controllers\Controller;
use Validator;
use Illuminate\Support\Fluent;
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
.ui-datepicker {
background-color: #fff;
border: 1px solid #66AFE9;
border-radius: 4px;
box-shadow: 0 0 8px rgba(102,175,233,.6);
display: none;
margin-top: 4px;
padding: 10px;
width: 240px;
}