Skip to content

Instantly share code, notes, and snippets.

@lfbn
lfbn / quotes.md
Last active October 3, 2020 16:27
[Quotes from the book "The Pragmatic Programmer: From Journeyman to Master"] #books #quotes

What Makes a Pragmatic Programmer?

Never run on auto-pilot. Constantly be thinking, critiquing your work in real time.

Individual Pragmatists, Large Teams

We who cut mere stones must always be envisioning cathedrals.

1 - A Pragmatic Philosophy

@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;
@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 / 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 / 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 / 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 / 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;
}
; 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
<?php
namespace App\Services\Dto;
abstract class AbstractDto
{
/**
* AbstractRequestDto constructor.
* @param array $data
*/
@lfbn
lfbn / UnsafeClientIpProvider.php
Last active April 4, 2022 04:05
[[php] Get unsafe client IP]
<?php
/**
* Class UnsafeClientIpProvider
*/
class UnsafeClientIpProvider
{
/**
* @var array