Skip to content

Instantly share code, notes, and snippets.

View diegofelix's full-sized avatar

Diego Felix diegofelix

View GitHub Profile
#Criado por Adler Parnas <[email protected]> #
# #
# 2011-02-23 #
# #
# Adaptado por Lauro Guedes <leowgweb.com> #
# #
# 2015-11-26 #
###########################################################
# #
# Script para criar um virtual host no apache e adicionar #
@diegofelix
diegofelix / commands.txt
Created February 9, 2015 11:42
Remove a tracked file in .gitignore
git rm --cached file.txt
git commit -m "Removed file.txt from cache"
@diegofelix
diegofelix / index.php
Created February 7, 2014 14:18
Laravel 4: Download a string as a file
// return an string as a file to the user
return Response::make($content, '200', array(
'Content-Type' => 'application/octet-stream',
'Content-Disposition' => 'attachment; filename="file-name.ext'
));
@diegofelix
diegofelix / gist:8538432
Last active January 3, 2016 23:59 — forked from daylerees/gist:8537274
Laravel 4: Base Validator

My Validation Base Class

I was asked how I deal with validation / create and update validation rulesets. Well here is one method I have used. Don't be afraid to build on top of what the framework has already given you. In my projects I use a base class for almost anything. You never know when you want your classes to inherit some common functionality. My BaseValidator actually has some pretty useful methods and properties in it.

<?php

namespace FooProject\Internal\Validators;

use FooProject\Internal\Sanitizers\BaseSanitizer;
@diegofelix
diegofelix / routes.php
Created January 9, 2014 10:12 — forked from fhferreira/routes.php
Laravel 4: Custom Paginator
<?php
View::composer(Paginator::getViewName(), function($view) {
$query = array_except( Input::query(), Paginator::getPageName() );
$view->paginator->appends($query);
});
@diegofelix
diegofelix / gist:8314644
Last active January 2, 2016 14:09
Laravel 4: Delete Form Macro
<?php
/*
|--------------------------------------------------------------------------
| Delete form macro
|--------------------------------------------------------------------------
|
| This macro creates a form with only a submit button.
| We'll use it to generate forms that will post to a certain url with the DELETE method,
| following REST principles.
@diegofelix
diegofelix / filters.php
Created November 18, 2013 12:32 — forked from zmsaunders/filters.php
Laravel 4: Minifying Html Response
<?php
### --- Snip --- ###
App::after(function($request, $response)
{
// HTML Minification
if(App::Environment() != 'local')
{
if($response instanceof Illuminate\Http\Response)
@diegofelix
diegofelix / laravel-weekly-23-quick-tip.php
Created September 17, 2013 15:42 — forked from driesvints/laravel-weekly-23-quick-tip.php
Laravel 4: Form range examples
<?php
# Create a list with numbers ranging from 10 to 20.
Form::selectRange('number', 10, 20);
# Create a list with years ranging from 1900 to 2000.
Form::selectYear('year', 1900, 2000);
# Creates a list with month names.
Form::selectMonth('month');
@diegofelix
diegofelix / SublimeText3_ContextMenuReg
Last active December 20, 2015 04:29 — forked from iaian/sublimeText2_contextMenu.reg
Sublime Text 3: Adding Context Menu on Windows
Windows Registry Editor Version 5.00
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@diegofelix
diegofelix / gist:5404428
Last active December 16, 2015 08:18 — forked from rjv/gist:5372014
Laravel 4: Installing via Composer
composer create-project laravel/laravel --prefer-dist