Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Vagner Luz do Carmo vluzrmos

🏠
Working from home
View GitHub Profile
@vluzrmos
vluzrmos / json.php
Last active Aug 29, 2015
Exemplo da utilização do json_encode do PHP
View json.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 Aug 29, 2015
Laravel Helper para redirecionar o usuário devolta para a última página ou para um lugar default.
View laravel_redirect_back.php
<?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 Aug 29, 2015
Customizando o select do Tora
View form_builder_select.rb
<%
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 Aug 29, 2015
Configuração do MySQL Server para aceitas arquivos grandes
View my.ini
[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 Sep 21, 2017 — forked from dr-dimitru/.htaccess
Laravel 4.2 HTACCESS
View .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 Aug 29, 2015
Estende as funcionalidades do Twitter Boostrap
View bootstrap-extend.css
/*
Permite truncar o texto das celulas e fixar a largura da tabela
*/
.table-truncated {
table-layout: fixed;
}
.table-truncated td{
white-space: nowrap;
View po.md

Editando arquivos .po

nano file.po

Compilando

msgfmt -cv -o file.mo file.po
@vluzrmos
vluzrmos / app\views\shared\_listagem.rhtml
Last active Aug 29, 2015
configuração do shared listagem
View app\views\shared\_listagem.rhtml
<% @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 Mar 5, 2015
Remove file from all commits on all branches
View git_filter_branch.sh
# 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 Aug 29, 2015
Laravel Lumen CORS Middleware