Skip to content

Instantly share code, notes, and snippets.

View sidis405's full-sized avatar

Sidrit Trandafili sidis405

View GitHub Profile
@sidis405
sidis405 / singularize.php
Created October 17, 2015 19:42 — forked from peter-mcconnell/singularize.php
PHP singularize
<?php
/**
* Singularize a string.
* Converts a word to english singular form.
*
* Usage example:
* {singularize "people"} # person
*/
function singularize ($params)
{
@sidis405
sidis405 / EloquentFooRepository.php
Created December 20, 2016 13:16 — forked from thepsion5/EloquentFooRepository.php
Example implementation of a Eloquent-based repository that provides a fluent interface for sorting and pagination without exposing the underlying model API.
<?php
class EloquenFooRepository
{
/**
* The base eloquent model
* @var Eloquent
*/
protected $model;
server {
listen 80;
server_name HOST_NAME;
root "/var/www/HOST_NAME/current/public";
index index.php index.html index.htm;
access_log off;
error_log /var/log/nginx/HOST_NAME.error.log crit;
@sidis405
sidis405 / BindDatabaseServiceProvider.php
Created June 25, 2018 06:57 — forked from zabaala/BindDatabaseServiceProvider.php
php artisan db:log <start> <stop>
<?php
namespace App\Commands\Database;
use Illuminate\Support\ServiceProvider;
class BindDatabaseServiceProvider extends ServiceProvider
{
public function boot()
{
@sidis405
sidis405 / php-pools.md
Created May 25, 2020 10:48 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@sidis405
sidis405 / nginx.conf
Created September 15, 2023 08:24 — forked from ulyssesr/nginx.conf
Nginx RTMP Setup
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;