Skip to content

Instantly share code, notes, and snippets.

View YavorK's full-sized avatar
🥥

Yavor Kirov YavorK

🥥
View GitHub Profile
# encoding: UTF-8
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
# To use the locales, use `I18n.t`:
# I18n.t 'hello'
# In views, this is aliased to just `t`:
# <%= t('hello') %>
# To use a different locale, set it with `I18n.locale`:
# I18n.locale = :es
Controllers:
- File and Folder Structure:
App/Http/Controllers
/Backend/
AdminController.php
WorkplaceController.php
WorkplaceDeliveryController.php
...
/Frontend/
...
@YavorK
YavorK / _messages.blade.php
Last active June 25, 2021 12:05
Laravel handle-all-flash-messages partial-view
@if ($errors->any())
<div class="alert alert-danger">
@foreach ($errors->all() as $error)
{!! $error !!}<br/>
@endforeach
</div>
@endif
@if (Session::get('flash_success'))
<div class="alert alert-success">
@if(is_array(Session::get('flash_success')))
@YavorK
YavorK / debug.php
Created August 31, 2016 13:46 — forked from eddieajau/debug.php
Printing a clean debug backtrace in PHP.
// PHP < 5.3.6
foreach (debug_backtrace() as $trace)
{
echo sprintf("\n%s:%s %s::%s", $trace['file'], $trace['line'], $trace['class'], $trace['function']);
}
die;
// PHP >= 5.3.6
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
die;
<?php
Artisan::command('db:port-original', function () {
//Laravel Remote is AWESOEM // https://laravelcollective.com/docs/5.3/ssh#sftp-downloads ...
//make sure process does not get killed
set_time_limit(0);
//define some values
$archiveName = env('ORIGINAL_SERVER_DB_DUMP_ARCHIVE_NAME');
@YavorK
YavorK / import-remote-db-with-laravel.php
Last active September 16, 2021 23:21
Import Remote DB with Laravel.
<?php
//import db from original server to local one...
/**
* Instructions:
* 1. Install this package: https://laravelcollective.com/docs/5.3/ssh
* 2. Add those to your .env file and fill up the values:
ORIGINAL_SERVER_SSH_ADDRESS=
ORIGINAL_SERVER_SSH_USERNAME=
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Remote Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify the default connection that will be used for SSH
@YavorK
YavorK / names.php
Last active October 19, 2016 04:43
A list of female names and a list of male names as a php array
<?php
//to generate: https://gist.github.com/YavorK/f91780cd29a290fd7b9846f97ab8cf17
$maleNames = array (
0 => 'Jamey Bogan',
1 => 'Dr. Afton Crona V',
2 => 'Ronaldo Bahringer PhD',
3 => 'Dr. Korbin Feeney I',
4 => 'Jamil Beer',
@YavorK
YavorK / generateNames.php
Last active October 19, 2016 04:46
Generate names with faker (fzaninotto/faker)
<?php
// this script uses https://github.com/fzaninotto/Faker
// to generate male/female names:
require 'vendor/autoload.php';
// use the factory to create a Faker\Generator instance
$faker = Faker\Factory::create();
// generate data by accessing properties
$maleNames = [];
@YavorK
YavorK / DateService.php
Last active November 30, 2016 14:45
DateService.php
<?php
class DateService
{
/**
* Return number of day in the week in an European manner,
* 0 is Monday, 6 is Sunday
* @param $unixTimestamp integer
* @return integer