Skip to content

Instantly share code, notes, and snippets.

View vluzrmos's full-sized avatar
🏠
Working from home

Vagner Luz do Carmo vluzrmos

🏠
Working from home
View GitHub Profile
@vluzrmos
vluzrmos / lumen-HasIntendedRoute.php
Last active August 29, 2015 14:25
Lumen get intended route.
<?php
// namespace Your\Awesome\Namespace\Here;
use Illuminate\Http\Request;
/**
* Trait HasIntendedRoute.
*/
trait HasIntendedRoute
@vluzrmos
vluzrmos / HasRandomStatementTrait.php
Last active May 12, 2016 21:06
Laravel Eloquent Agnostic Random Statement
<?php
trait HasRandomStatementTrait
{
/**
* Random Statements by driver name.
* @var array
*/
protected $randomStatements = [
'mysql' => 'RAND()',
@vluzrmos
vluzrmos / principais_packages.md
Last active June 17, 2020 21:48
Lista dos principais packages para Laravel citados no 16º Hangout Laravel Brasil.
@vluzrmos
vluzrmos / import_tgz.sh
Last active August 29, 2015 14:26
Function to import tgz file to mysql.
import_tgz(){
tar -xOzf $1 | mysql -u ${2:-root} -p${3:-1234}
}
@vluzrmos
vluzrmos / Post.php
Created August 6, 2015 01:37
Example how to remove the eager loading on Eloquent.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
/**
* Array of relationships to load.
@vluzrmos
vluzrmos / ibdm-sublime-text.settings.json
Last active September 11, 2015 10:37
My Sublime text settings with Material Theme.
{
"always_show_minimap_viewport": false,
"bold_folder_labels": false,
"color_scheme": "Packages/User/SublimeLinter/darkula (SL).tmTheme",
"enable_tab_scrolling": false,
"font_size": 13,
"folder_exclude_patterns": [".svn", ".idea", ".hg", "CVS"],
"ignored_packages":
[
"Vintage"
@vluzrmos
vluzrmos / gist:da516cde6f303dc343fe
Created November 4, 2015 19:54 — forked from devster/gist:9545326
Install mscorefonts on debian wheezy
# Add this repo to the /etc/apt/source.list file
deb ftp://ftp.debian.org/debian stable contrib non-free
# And run these commands
sudo apt-get update
sudo apt-get install ttf-mscorefonts-installer
@vluzrmos
vluzrmos / add.sh
Created February 20, 2016 01:02
Configurar o SSL CERT para o CURL em todos os apps
# Adicione a seguinte variável ao seu sistema:
SSL_CERT_FILE=/path/to/curl-ca-bundle.crt
# Você pode pegar uma cópia desse certificado no diretório bin do GIT
@vluzrmos
vluzrmos / Laravel_Response_Streamed.php
Created May 11, 2016 18:05 — forked from langemike/streamed.php
Laravel response macro for streamed responses with seeking support (with bug fixes & usage example)
<?php
Response::macro('streamed', function($type, $size, $name, $callback) {
$start = 0;
$length = $size;
$status = 200;
$headers = [
'Content-Type' => $type,
'Content-Length' => $size,
@vluzrmos
vluzrmos / paginate.php
Created July 20, 2016 14:31
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator