Skip to content

Instantly share code, notes, and snippets.

View duard's full-sized avatar

Carlos Eduardo duard

View GitHub Profile
@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
source 'https://rubygems.org'
gem 'rails', '3.2.10'
################################################################################
# Gems para o sistema em geral
################################################################################
gem 'inherited_resources'
gem 'simple_form'
################################################################################
@duard
duard / tabs
Created February 21, 2013 13:43
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Le styles -->
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
</head>
<body>