Skip to content

Instantly share code, notes, and snippets.

View duard's full-sized avatar

Carlos Eduardo duard

View GitHub Profile
@duard
duard / vagrantconfig
Created February 26, 2014 15:55
Vagrant Config
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@duard
duard / vagrantfile
Created February 26, 2014 18:46
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
config.vm.hostname = 'devbox'
config.vm.synced_folder ".", "/Projects", id: "vagrant-root"
@duard
duard / errors installing.rb
Created October 3, 2012 16:35
Errors installing ruby on CENTOS 6.3
{12-10-03 13:23}vps:~ carcia% which rails
rails not found
{12-10-03 13:30}vps:~ carcia% curl -L https://get.rvm.io | bash -s stable --ruby
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10009 100 10009 0 0 10348 0 --:--:-- --:--:-- --:--:-- 89366
Please read and follow further instructions.
Press ENTER to continue.
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
@duard
duard / thumb.php
Created October 10, 2012 12:04
Thumb do Uberaba
<?php
//------------------------------------|| RESIZE BASIC ||----------------------------------
require_once 'includes/thumb/ThumbLib.inc.php';
//Recebe parametros
$img = $_GET['img'];
$wi = $_GET['width'];
$he = $_GET['height'];
//Cria imagem
<div id="work">
<ul class="thumbnails">
<?php $loop = new WP_Query( array( 'post_type' => 'work', 'posts_per_page' => 9 ) ); ?>
<?php $i = 0; // starts the counter ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php if ($i % 3 == 0 ) {
echo '<li class="span4" style="clear:left;">'; // clear left if start of new row.
} else {
echo '<li class="span4">'; // continuation of a row, no need to clear left.
defaults: &DEFAULTS
adapter: mysql2
encoding: utf8
reconnect: true
pool: 5
host: localhost
username: railsSQL
password: senhadomysql
development:
#!/bin/env ruby
# encoding: utf-8
##################################################################################################
source 'https://rubygems.org'
##################################################################################################
gem 'rails', '3.2.8'
gem 'mysql2'
gem 'thin'
gem 'twitter-bootstrap-rails'
gem 'brazilian-rails'
source 'https://rubygems.org'
gem 'rails', '3.2.10'
gem 'mysql2'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
@duard
duard / veiculo.rb
Created January 8, 2013 17:37
detalhes de um veiculo, é um model, ligado ao model de veiculo
class CreateDetalhes < ActiveRecord::Migration
def change
create_table :detalhes do |t|
t.references :veiculo
t.references :user
# CONFORTO DO VEÍCULO CARRO
t.boolean :abertura_interna_do_porta_malas
t.boolean :ar_condicionado
@duard
duard / application_controller.rb
Created January 11, 2013 17:58
Tem que validar no controler da aplicacao e no de admin ... isso nao é o melhor jeito, mas funfa beleza
#!/bin/env ruby
# encoding: utf-8
class ApplicationController < ActionController::Base
protect_from_forgery
def after_sign_in_path_for(resource)
inicio_path
end
def after_sign_out_path_for(resource)
inicio_path
end