Skip to content

Instantly share code, notes, and snippets.

View rafamvc's full-sized avatar

Rafael Floresta rafamvc

  • Philadelphia, PA
View GitHub Profile
<% categories_column_size = (categories.size / 4).ceil %>
<div class="row">
<% # the false on the next line removes the nils you used to protect with the if category %>
<% categories.in_groups_of(categories_column_size, false) do |n_categories| %>
<div class="large-3 columns">
<% n_categories.each do |category| %>
<div class="row">
<div class="large-10 columns">
<%= label_tag category.name, category.name, class: 'right inline' %>
@rafamvc
rafamvc / en.yml
Created March 20, 2014 16:53
Formatting Time and Date locale
en:
date:
formats:
default: "%m/%d/%Y"
short: "%m/%d"
datetime:
formats:
default: "%m/%d/%Y %H:%M"
short: "%H:%M"
notime: "%m/%d/%Y"
@rafamvc
rafamvc / new.html.erb
Created March 7, 2012 14:38
Two step new example for Chris
<%= simple_form_for(@model, :url => step2_two_step_new_path, :method => :post) do |form| %>
<%= form.input :name %>
<%= form.input :description %>
<%= form.button :submit, "Next" %>
<% end %>
@rafamvc
rafamvc / <controller_name>.js
Created February 16, 2012 16:02
How I render my page specific JS
// On the page specific file:
// "<controller_name>.js", and you import it after the init.js on your application.js
// Replace the <controller_name> with the actual name
RELASPHERE.<controller_name> = {
init: function() {
// Your shared code for the whole controller goes here
},
index: function() {
// Your code for the index page goes here
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{jsonify}
s.version = "0.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Bill Siggelkow"]
s.date = %q{2011-08-09}
s.description = %q{Turn Ruby objects into JSON -- correctly!}
@rafamvc
rafamvc / handle_async_example.rb
Created April 13, 2011 00:47
handle_async exampole
# using handle_async
class TestObj
# All requests coming for #long_background_processing_method will be handled in the background
schedule :every => 30.minutes do
# Code here
end
def method1
@rafamvc
rafamvc / test_obj.rb
Created April 8, 2011 20:43
Example of a mexican class
class TestObj
# All requests coming for #long_background_processing_method will be handled in the background
handle_async :method1
# This needs access to be a class method
schedule :method2, :every => :day, :at => '12:55am'
# The multiple will not allow two #method3 to run at the same time
rcardo-mac:~ rafamvc$ rails new mp3store
rails gener create
create README
create Rakefile
create config.ru
a create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
define(function(require, exports, module) {
^
ReferenceError: define is not defined
at Object.<anonymous> (/Users/rafamvc/workspace2/cloud9/support/lib-v8debug/lib/v8debug/NodeSocket.js:9:1)
at Module._compile (node.js:461:23)
at Module._loadScriptSync (node.js:468:10)
at Module.loadSync (node.js:338:12)
at loadModule (node.js:283:14)
at require (node.js:411:14)
at Object.<anonymous> (/Users/rafamvc/workspace2/cloud9/server/ext/debugger/nodedebugproxy.js:7:18)
/Users/rafamvc/Developer/.rvm/gems/ruby-1.8.7-p248/gems/rspec-1.3.0/lib/spec/example/example_group_factory.rb:28:in `create_example_group': ArgumentError (ArgumentError)
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.8.7-p248/gems/rspec-1.3.0/lib/spec/dsl/main.rb:28:in `context'
from /Users/rafamvc/workspace/mms-service/test/factories.rb:15
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.8.7-p248/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb:50:in `define'
from /Users/rafamvc/workspace/mms-service/test/factories.rb:12
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.8.7-p248/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:158:in `require'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.8.7-p248/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:158:in `require'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.8.7-p248/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb:296:in `find_definitions'
from /Users/rafamvc/Developer/.