Skip to content

Instantly share code, notes, and snippets.

View diegofelix's full-sized avatar

Diego Felix diegofelix

View GitHub Profile
@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 / 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 / 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"
#Criado por Adler Parnas <adler.parnas@doisdeum.com.br> #
# #
# 2011-02-23 #
# #
# Adaptado por Lauro Guedes <leowgweb.com> #
# #
# 2015-11-26 #
###########################################################
# #
# Script para criar um virtual host no apache e adicionar #
@diegofelix
diegofelix / Preferences.sublime-settings
Last active August 8, 2016 14:54
My Sublime Preferences
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_extra_width": 2,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
"font_face": "Operator Mono",
"font_options":
[
"gray_antialias",
"subpixel_antialias"
@diegofelix
diegofelix / grid.styl
Last active May 24, 2016 17:40
Simple 12 Grid Column
.grid
clear both
padding 0px
margin 0px
display block
zoom 1 /* For IE 6/7 */
.grid:before,
.grid:after
content ""
@diegofelix
diegofelix / Keygen.php
Created June 30, 2016 18:55
Keygen.php
<?php
namespace App\Services;
class Keygen {
/**
* Removed zeroes and o's to avoid missreading
*
* @var string
@diegofelix
diegofelix / NiceSelect.sass
Last active July 8, 2016 15:48
Nice Select Combo Box
// <div class="NiceSelect NiceSelect--focus">
// <span class="NiceSelect__text">Option Selected</span>
// <select>
// <option value="1">Option Selected</option>
// <option value="2">Other Option</option>
// </select>
// </div>
.NiceSelect
width: 100%
position: relative
@diegofelix
diegofelix / center.css
Created July 18, 2016 17:44
center something vertically
/* This parent can be any width and height */
.block {
text-align: center;
height: 100px;
/* May want to do this if there is risk the container may be narrower than the element inside */
white-space: nowrap;
}
/* The ghost, nudged to maintain perfect centering */
.block:before {
@diegofelix
diegofelix / sublime-packages.txt
Last active February 20, 2018 12:06
sublime-packages.txt
advanced new file
bracketHighlighter
docblockr
dotEnv
emmet
expand tabs on save
gist
html-css-js prettyfy
blade highlighter
material theme