Skip to content

Instantly share code, notes, and snippets.

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

Diego Collares Senhordim

🏠
Working from home
View GitHub Profile
@Senhordim
Senhordim / youtube.rb
Created March 20, 2012 19:43
Helper para pegar vídeo do youtube
#youtube videos
def youtube_video_tag(id, html_options = {})
video_tag "http://www.youtube.com/embed/#{id}"
end
<?php
//1 – Definimos Para quem vai ser enviado o email
$para = "seu-email@dominio.com.br";
//2 - resgatar o nome digitado no formulário e grava na variavel $nome
$nome = $_POST['nome'];
// 3 - resgatar o assunto digitado no formulário e grava na variavel //$assunto
$assunto = $_POST['assunto'];
//4 – Agora definimos a mensagem que vai ser enviado no e-mail
$mensagem = "<strong>Nome: </strong>".$nome;
$mensagem .= "<br> <strong>Mensagem: </strong>".$_POST['mensagem'];
@Senhordim
Senhordim / setup_devise
Created October 25, 2013 17:19
Setup Devise
Some setup you must do manually if you haven't yet:
1. Ensure you have defined default url options in your environments files. Here
is an example of default_url_options appropriate for a development environment
in config/environments/development.rb:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
In production, :host should be set to the actual host of your application.
@Senhordim
Senhordim / config.rb
Last active January 1, 2016 13:49
Gerar scaffold limpo sem helpers, test e assets.
# Adicione o código dentro do module em config/application.rb
config.generators do |g|
g.assets false
g.helper false
g.test_framework nil
end
@Senhordim
Senhordim / ui.datepicker-pt-BR.js
Created December 28, 2013 01:55
Tradução datepicker pt-BR
/* Brazilian initialisation for the jQuery UI date picker plugin. */
/* Written by Leonildo Costa Silva (leocsilva@gmail.com). */
jQuery(function($){
$.datepicker.regional['pt-BR'] = {
closeText: 'Fechar',
prevText: '&#x3c;Anterior',
nextText: 'Pr&oacute;ximo&#x3e;',
currentText: 'Hoje',
monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
@Senhordim
Senhordim / alert.html.erb
Created December 30, 2013 13:42
Simples alert bootstrap
<% if flash[:notice].present? %>
<div class="alert alert-success" role="alert">
<a class="close" data-dismiss="alert">×</a>
<%= flash[:notice] %>
</div>
<% end %>
<% if flash[:alert].present? %>
<div class="alert alert-error" role="alert">
<a class="close" data-dismiss="alert">×</a>
# encoding: utf-8
require 'csv'
class AssociadosController < ApplicationController
authorize_resource
def index
if params['filtro'].present?
@Senhordim
Senhordim / index.html.slim
Last active August 29, 2015 13:55
Slim-template
doctype html
html
head
title Slim Examples
meta name="keywords" content="template language"
meta name="author" content=author
javascript:
alert('Slim supports embedded javascript!')
body
@Senhordim
Senhordim / simple_form_bootstrap.rb
Created February 19, 2014 18:53
Using Twitter Bootstrap 3 with simple_form
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.wrappers :bootstrap, :tag => 'div', :class => 'form-group', :error_class => 'has-error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.use :input, :wrap_with => { :tag => 'div', :class => 'controls' }
b.use :error, :wrap_with => { :tag => 'span', :class => 'help-block' }
b.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
@Senhordim
Senhordim / restart
Created March 17, 2014 17:16
VirtualBox restart
# OSX
sudo /Library/StartupItems/VirtualBox/VirtualBox restart