Skip to content

Instantly share code, notes, and snippets.

View mehranhadidi's full-sized avatar
🚀

Mehran Hadidi mehranhadidi

🚀
  • Solvd
View GitHub Profile
@mehranhadidi
mehranhadidi / sql.txt
Last active August 23, 2016 05:04
Log SQL queries in laravel
// should add to AppServiceProvider@boot
\DB::listen(function ($query) { \Log::info($query->sql, $query->bindings); });
// should add to routes.php
Event::listen('illuminate.query', function($query)
{
var_dump($query);
});
// eager load in laravel new way
$post = Post::find(1);
$post->load('comments.owner'); // will load the post + comments (relationship) + owner (relationship)
return $post;
# How to show current git branch name
# Add following lines to your ~/.bash_profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
# ----------------------------------------------------------------------------------------------
@mehranhadidi
mehranhadidi / compat_l5.php
Created December 6, 2016 08:24 — forked from vluzrmos/compat_l5.php
Lumen L5 compatibility helpers. That file should be added on root path of your project... and added to your composer.json
<?php
if(!function_exists('config_path'))
{
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path=null)
@mehranhadidi
mehranhadidi / principais_packages.md
Created December 6, 2016 08:34 — forked from vluzrmos/principais_packages.md
Lista dos principais packages para Laravel citados no 16º Hangout Laravel Brasil.
@mehranhadidi
mehranhadidi / alias
Created December 13, 2016 13:12
useful alias on ubuntu
# add these lines to ~/.bashrc
#aliases
source ~/.aliases
# create file ~/.aliases and add these lines to that file.
# git
alias gs='git status'
alias ga='git add'
alias gc='git commit -m'
@mehranhadidi
mehranhadidi / API.md
Created January 22, 2017 14:13 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@mehranhadidi
mehranhadidi / RouteServiceProvider.php
Created January 25, 2017 09:06 — forked from danielmorgan/RouteServiceProvider.php
Move auth routes to userland code in Laravel 5.3
# app/providers/RouteServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
@mehranhadidi
mehranhadidi / tmux.md
Created February 7, 2017 08:23 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@mehranhadidi
mehranhadidi / gist:3bbd0af99bafa8bba764bc4b39d9659d
Last active February 16, 2017 07:56
Dev Machine setup (Ubuntu 16.10)

Check For Updates

  • sudo apt-get update
  • sudo apt-get upgrade