Skip to content

Instantly share code, notes, and snippets.

View zgabievi's full-sized avatar
💤
Zzzing

Zura Gabievi zgabievi

💤
Zzzing
View GitHub Profile
@zgabievi
zgabievi / Countries.md
Last active January 19, 2016 15:47
Countries with translations, iso codes and mobile prefixes
Country ქვეყანა Страна prefix iso3 iso2
Kazakhstan ყაზახეთი Казахстан +7 KAZ KZ
Georgia საქართველო Грузия +995 GEO GE
Azerbaijan აზერბაიჯანი Азербайджан +994 AZE AZ
Afghanistan ავღანეთი Афганистан +93 AFG AF
Aland Islands ოლანდის კუნძულები Аландские острова +358
@zgabievi
zgabievi / artisan
Created January 19, 2016 15:44
artisan edit for Laravel 5.2
if(isset($argv[1]) && $argv[1] == 'list' && isset($argv[2]) && $argv[2] == '--xml') {
$argv[2] = '--format=xml';
$_SERVER['argv'] = $argv;
}
if (isset($argv[1]) && $argv[1] === '-V') {
die('Symfony version 3.0.0');
}
@zgabievi
zgabievi / app.php
Last active January 31, 2016 14:19
Localization
<?php
return [
'locale' => 'en',
'locales' => [
'en' => 'English',
'ka' => 'Georgian',
'ru' => 'Russian',
],
#!/bin/bash
LOG=/path/to/logs/COMMAND.log
while true; do
nohup /path/to/php /path/to/artisan COMMAND >> ${LOG} &
PID=$!
echo [`date +%Y-%m-%d:%H:%M:%S`] ${PID} STARTED >> ${LOG}
@zgabievi
zgabievi / util.js
Last active April 27, 2016 10:33
You might no need jquery
var _ = {};
//
_.request = function (url, method, data, successCallback, errorCallback, isJson) {
var request = new XMLHttpRequest();
request.open(method, url, true);
//
request.onload = function() {
@zgabievi
zgabievi / install.sh
Created September 7, 2016 19:06
Larval 5.* on Ubuntu 16.04
# Basic stuff
sudo apt-get install git
sudo apt-get install unzip
# LAMP & Taskel
sudo apt-get install tasksel
sudo tasksel install lamp-server
# CURL for Composer
sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext
@zgabievi
zgabievi / Album.php
Last active October 28, 2016 11:08
Laravel “Many To Many Polymorphic Relations”
<?php
namespace App;
class Album {
/**
* Get all of the orders for the book.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
@zgabievi
zgabievi / Archives.php
Last active January 28, 2017 20:11
Laravel best practices
<?php
// query builder
Model::selectRaw('YEAR(created_at) year, MONTHNAME(created_at) month, COUNT(*) published')
->groupBy('year', 'month')
->get()
->toArray();
// parse month string
Carbon::parse('May')->month;

413: Request entity too large

  1. edit ~/.valet/Nginx/SITE_NAME.dev
  2. add client_max_body_size 500M; there:
  • for HTTPS in server block which listens 443 (after charset utf-8;)
  • for HTTP in server block which listens 80
  1. run valet restart
@zgabievi
zgabievi / TestCase.php
Last active May 3, 2017 08:00
Way to make TDD easy, with exception handling and factory helpers
<?php
namespace Tests;
use App\Exceptions\Handler;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{