Skip to content

Instantly share code, notes, and snippets.

@norbajunior
norbajunior / seeds.rb
Created August 30, 2011 13:25 — forked from dcrec1/seeds.rb
State of Brazil for Spree
states = <<STATES
28,AC,Acre
28,AL,Alagoas
28,AP,Amapá
28,AM,Amazonas
28,BA,Bahia
28,CE,Ceará
28,ES,Espírito Santo
28,GO,Goiás
28,MA,Maranhão
@norbajunior
norbajunior / rails_3_1_beta_1_changes.md
Created June 7, 2011 18:58 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 Beta 1

  • The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]

  • jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]

  • Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]

  • The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]

class SendMail < ActionMailer::Base
def contact(nome, fone, email, assunto, corpo)
recipients '[email protected]'
from "SITE:
subject assunto
sent_on Time.now
content_type "text/html"
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :all %>
<%= csrf_meta_tag %>
</head>
<body>
require 'yaml'
require 'logger'
require 'active_record'
namespace :db do
def create_database config
options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
create_db = lambda do |config|
ActiveRecord::Base.establish_connection config.merge('database' => nil)
var FactoryForm = function() {
var form = new Ext.form.FormPanel({
width: 400, height: 150, frame: true
, defaults : {
margins: {top:15, right:0, bottom:0, left:5}
}
, defaultType: "textfield"
, items: [
var instrutor = function(json, record) {
var nome = "";
record.instrutores.forEach(function(inst){ nome += (inst.nome + ", ") });
return nome;
}
var CursoFactory = Ext.data.Record.create(["id", "nome", "descricao",
{name:"instrutores", convert: instrutor}]);
var store = new Ext.data.Store({
Ext.XTemplate.from = function(el){
el = Ext.getDom(el);
var string = el.value || el.innerHTML;
string = string.replace(/%7B/g, "{").replace(/%7D/g, "}").replace(/%21/g, "!");
return new Ext.XTemplate(string);
};
if(!Array.prototype.add) {
Array.prototype.add = function(item) {
this[this.length] = item;
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"