Skip to content

Instantly share code, notes, and snippets.

@lfbn
lfbn / generate_sass_watch.sh
Last active April 23, 2020 13:46
Bash script to generate CSS from SASS in watch mode.
sass --update --style=compressed --no-source-map --watch stylesheets/main.scss:public/css/style.css
@lfbn
lfbn / UnsafeClientIpProvider.php
Last active April 4, 2022 04:05
[[php] Get unsafe client IP]
<?php
/**
* Class UnsafeClientIpProvider
*/
class UnsafeClientIpProvider
{
/**
* @var array
<?php
namespace App\Services\Dto;
abstract class AbstractDto
{
/**
* AbstractRequestDto constructor.
* @param array $data
*/
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
@lfbn
lfbn / without extensions.php
Last active July 17, 2020 14:46
[[php] Time profiling a PHP script] #performance
// https://stackoverflow.com/a/29022400/155905
// Call this at each point of interest, passing a descriptive string
function prof_flag($str)
{
global $prof_timing, $prof_names;
$prof_timing[] = microtime(true);
$prof_names[] = $str;
}
@lfbn
lfbn / QuoteRepository.php
Last active July 31, 2020 18:19
QuoteRepository.php #laravel #laravel_repositories
<?php
namespace App\Repositories\Eloquent;
use App\Model\Message;
use App\Model\Quote;
use App\Repositories\QuoteRepositoryInterface;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
@lfbn
lfbn / BaseRepository.php
Last active July 31, 2020 18:18
BaseRepository.php #laravel #laravel_repositories
<?php
namespace App\Repositories\Eloquent;
use Illuminate\Database\Eloquent\Model;
/**
* Class BaseRepository
* @package App\Repositories\Eloquent
*/
@lfbn
lfbn / QuoteRepositoryInterface.php
Last active July 31, 2020 18:17
QuoteRepositoryInterface.php #laravel #laravel_repositories
<?php
namespace App\Repositories;
/**
* Interface QuoteRepositoryInterface
* @package App\Repositories
*/
interface QuoteRepositoryInterface
{
@lfbn
lfbn / EloquentRepositoryInterface.php
Last active July 31, 2020 18:19
EloquentRepositoryInterface.php #laravel #laravel_repositories
<?php
namespace App\Repositories\Eloquent;
use Illuminate\Database\Eloquent\Model;
/**
* Interface EloquentRepositoryInterface
* @package App\Repositories\Eloquent
*/
@lfbn
lfbn / RepositoryServiceProvider.php
Last active July 31, 2020 18:20
RepositoryServiceProvider #laravel #laravel_repositories
<?php
namespace App\Providers;
use App\Repositories\CategoryRepositoryInterface;
use App\Repositories\Eloquent\BaseRepository;
use App\Repositories\Eloquent\CategoryRepository;
use App\Repositories\Eloquent\EloquentRepositoryInterface;
use App\Repositories\Eloquent\QuoteRepository;
use App\Repositories\QuoteRepositoryInterface;