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 / json.php
Last active August 29, 2015 14:02
Exemplo da utilização do json_encode do PHP
<?php
$pessoa = array(
"nome" => "Pessoa 1",
"sobrenome" => "da Silva"
);
echo json_encode($pessoa); // Vai gerar {"nome":"Pessoa 1", "sobrenome":"da Silva"}
// Se vc quiser um array de pessoas ...
@vluzrmos
vluzrmos / laravel_redirect_back.php
Last active August 29, 2015 14:05
Laravel Helper para redirecionar o usuário devolta para a última página ou para um lugar default.
<?php
function redirect_back_or_default($url = null){
try{
return Redirect::back();
}catch(Exception $e){
return Redirect::to($url);
}
}
@vluzrmos
vluzrmos / form_builder_select.rb
Last active August 29, 2015 14:08
Customizando o select do Tora
<%
tipo_ocor = {
:association => f.object.class.reflect_on_association(:tipo_ocorrencia),
:options => {:include_blank => true},
:html_options => {
:onchange => remote_function(:url => {
:controller => "advocacia/processos",
:action => "campos_tipo_ocorrencia",
:index => index
},
@vluzrmos
vluzrmos / my.ini
Last active August 29, 2015 14:10
Configuração do MySQL Server para aceitas arquivos grandes
[client]
...
max_allowed_packet=64M
[mysqld]
...
key_buffer=16M
max_allowed_packet=64M
sort_buffer_size=512K
net_buffer_length=8K
@vluzrmos
vluzrmos / .htaccess
Last active September 21, 2017 22:45 — forked from dr-dimitru/.htaccess
Laravel 4.2 HTACCESS
# ----------------------------------------------------------------------
# /PUBLIC folder .htaccess
# ----------------------------------------------------------------------
# This .htaccess file is recommended
# to be placed at root/public folder
# of your Laravel powered application
# ----------------------------------------------------------------------
# This file works with Laravel 3 and 4
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and
@vluzrmos
vluzrmos / bootstrap-extend.css
Last active August 29, 2015 14:12
Estende as funcionalidades do Twitter Boostrap
/*
Permite truncar o texto das celulas e fixar a largura da tabela
*/
.table-truncated {
table-layout: fixed;
}
.table-truncated td{
white-space: nowrap;
@vluzrmos
vluzrmos / po.md
Created December 28, 2014 10:01
poedit

Editando arquivos .po

nano file.po

Compilando

msgfmt -cv -o file.mo file.po
@vluzrmos
vluzrmos / app\views\shared\_listagem.rhtml
Last active August 29, 2015 14:12
configuração do shared listagem
<% @table_buttons.each do |button| %>
<%if button[:block].blank? or button[:block].call %>
<span class="button">
<% _button = button.dup
_button.delete(:block)
confirm = _button.delete(:confirm)
popup = _button.delete(:popup)
name = _button.delete(:name)
@vluzrmos
vluzrmos / git_filter_branch.sh
Created March 5, 2015 01:49
Remove file from all commits on all branches
# Remove file from all commits on all branches
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch FILENAMEHERE" --prune-empty --tag-name-filter cat -- --all
# After
git push --all --force
@vluzrmos
vluzrmos / README.md
Last active August 29, 2015 14:19
Laravel Lumen CORS Middleware