Skip to content

Instantly share code, notes, and snippets.

View hidenowt's full-sized avatar

Herminio Torres hidenowt

View GitHub Profile
@hidenowt
hidenowt / gist:945178
Created April 27, 2011 20:53
Truque para o Bundler com extensões de C
# Gemfile
source 'http://rubygems.org'
source "http://gems.github.com"
gem 'rails', '3.0.6'
gem 'pg'
$ bundle install
Fetching source index for http://rubygems.org/
Fetching source index for http://gems.github.com/
<!DOCTYPE html>
<head>
<!-- bem quando eu uso dessa forma meu layout o sinatra da um erro em: @texto.conteudo -->
<!-- mas quando eu retiro o @texto.conteudo o codigo de exemplo funciona todo perfeitamente -->
<title><%= @texto.conteudo || "My Texts!" %></title>
</head>
<body>
Text:<br />
<%= yield %>
</body>
require 'rubygems'
require 'sinatra'
require 'dm-core'
require 'dm-validations'
require 'dm-timestamps'
# bem na apostila esqueceu de incluir essa gem
require 'dm-migrations'
# lembrar de informar na apostila a instalação da gem dm-mysql-adapter
DataMapper.setup(:default, "mysql://localhost/textos")
@hidenowt
hidenowt / com.mysql.mysqld.plist
Created February 17, 2011 15:00
com.mysql.mysqld.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/usr/local/mysql/bin/mysqld_safe</string>
@hidenowt
hidenowt / .bash_profile
Created February 17, 2011 14:55
Bem lembrando que todos esses arquivos eu estou colocando tudo na home do meu usuario "~/" ou /Users/meu_usuario/
.bash_profile
# exports
#export PATH="/usr/local:$PATH"
export PATH="/usr/local/mysql/bin:$PATH"
#export ARCHFLAGS="-arch i386 -arch x86_64"
export ARCHFLAGS="-arch x86_64"
export GREP_OPTIONS="--color=auto"
~$ cd nome_da_minha_aplicacao
~/nome_da_minha_aplicacao$ script/about
About your application's environment
Ruby version 1.8.7 (i686-linux)
RubyGems version 1.3.3
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
~$ rails _2.2.2_ nome_da_minha_aplicacao
<!-- index -->
<%= image_tag @user.avatar.url %>
<%= image_tag @user.avatar.url(:small) %>
<%= image_tag @user.avatar.url(:large) %>
<!-- index -->
<!-- show -->
<!-- new -->
<% @nome_pagina = 'Adicionar User' %>
<!-- o multipart é para informar que irá ser feito o carregamento/upload de um arquivo -->
<% form_for(@user, :html => { :multipart => true }) do |f| %>
<%= render :partial => "user", :locals => { :f => f } %>
<%= f.submit "Criar User" %>
<% end %>
<%= link_to 'Retornar', users_path %>
<!-- new -->
<!-- partial -->
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :email %><br />
<%= f.text_field :email %>