Skip to content

Instantly share code, notes, and snippets.

View PierreLebedel's full-sized avatar

Pierre Lebedel PierreLebedel

View GitHub Profile
@PierreLebedel
PierreLebedel / ViewServiceProvider.php
Created February 8, 2024 13:06
Blade directive for @price (EUR)
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
final class ViewServiceProvider extends ServiceProvider
{
public function boot(): void
@PierreLebedel
PierreLebedel / Envoy.blade.php
Last active February 8, 2024 08:57
Laravel Envoy config for staging & production
@servers([
'staging' => 'user@X.X.X.Y -p 22',
'production' => 'user@X.X.X.Z -p 22',
])
@setup
if (empty($server)) {
exit('ERROR: envoy run option --server is undefined'.PHP_EOL);
}
if($server=='production'){
@PierreLebedel
PierreLebedel / .env
Last active January 28, 2024 15:54
Configuration files for beyondcode/laravel-websockets:1.14.1 on Laravel 10 with Supervision and SSL on Apache 2.4
PUSHER_APP_ID=examplesite-appid
PUSHER_APP_KEY=examplesite-appkey
PUSHER_APP_SECRET=examplesite-appsecret
PUSHER_APP_CLUSTER=mt1
PUSHER_HOST=www.examplesite.com
PUSHER_PORT=6001
PUSHER_SCHEME=http
LARAVEL_WEBSOCKETS_PORT=443
LARAVEL_WEBSOCKETS_VERIFY_PEER=false
@PierreLebedel
PierreLebedel / app.scss
Created January 26, 2024 13:50
Tabler.io styles for table tbody
@import "../../node_modules/@tabler/core/src/scss/tabler.scss";
.table {
tfoot {
th {
color: $table-th-color;
background: $table-th-bg;
font-weight: var(--#{$prefix}font-weight-bold);
text-transform: uppercase;
letter-spacing: .04em;
@PierreLebedel
PierreLebedel / datepickr.scss
Created January 18, 2024 09:15
Datepickr - Bootstrap5 theme
.flatpickr-calendar {
.numInputWrapper {
.arrowUp,
.arrowDown {
width: 20px;
padding: 0;
&:after {
@PierreLebedel
PierreLebedel / tailwind.blade.php
Last active December 21, 2023 15:30
Livewire pagination for daisyUI
@php
if (! isset($scrollTo)) {
$scrollTo = 'body';
}
$scrollIntoViewJsSnippet = ($scrollTo !== false)
? <<<JS
(\$el.closest('{$scrollTo}') || document.querySelector('{$scrollTo}')).scrollIntoView()
JS
: '';
@PierreLebedel
PierreLebedel / php
Created May 1, 2021 08:19
WordPress: add page template from custom plugin
<?php
/**
* Plugin Name: Page templates from plugin
* Plugin URI:
* Description: Page templates from plugin
* Version: 1.0.0
* Author: Pierre Lebedel
* Author URI: https://www.pierrelebedel.fr
*/
@PierreLebedel
PierreLebedel / FrenchHolidays.php
Created October 18, 2019 10:12
Calcul et affichage des jours fériés en France
<?php
/**
* Jours fériés en France
* Source : https://phpsources.net/code/php/date-heure/641_jours-feries-en-france
*/
class FrenchHolidays {
public static function isHoliday($day=false, $alsacemoselle=false){
@PierreLebedel
PierreLebedel / field_occurences.sql
Last active June 28, 2017 10:49
MySQL select rows where field contains X occurences
SELECT id, ROUND(
( LENGTH(field) - LENGTH( REPLACE(field, "search", "") ) ) / LENGTH("search")
) AS count
FROM table
@PierreLebedel
PierreLebedel / DateTimeFrench.php
Created January 5, 2017 10:42
PHP DateTime in french language
<?php
class DateTimeFrench extends DateTime {
public function format($format='j M Y'){
$days_full = array(
'Monday' => 'Lundi',
'Tuesday' => 'Mardi',
'Wednesday' => 'Mercredi',
'Thursday' => 'Jeudi',