Skip to content

Instantly share code, notes, and snippets.

View cassioscabral's full-sized avatar

Cassio Cabral cassioscabral

View GitHub Profile
@cassioscabral
cassioscabral / gist:7779871
Created December 3, 2013 23:51
Error when running rake task for spree
$ rake paperclip:refresh:thumbnails CLASS=Spree::Image
rake aborted!
795: unexpected token at '{:mini=>"244x173>", :small=>"236x236>", :roteiro=>"312x391>", :big=>"472x472>", :product=>"645x645>"}'
/home/cassio/.rvm/gems/ruby-2.0.0-p195@marazul/gems/json-1.8.0/lib/json/common.rb:155:in `parse'
/home/cassio/.rvm/gems/ruby-2.0.0-p195@marazul/gems/json-1.8.0/lib/json/common.rb:155:in `parse'
/home/cassio/.rvm/gems/ruby-2.0.0-p195@marazul/gems/multi_json-1.8.0/lib/multi_json/adapters/json_common.rb:16:in `load'
/home/cassio/.rvm/gems/ruby-2.0.0-p195@marazul/gems/multi_json-1.8.0/lib/multi_json/adapter.rb:20:in `load'
/home/cassio/.rvm/gems/ruby-2.0.0-p195@marazul/gems/multi_json-1.8.0/lib/multi_json.rb:120:in `load'
/home/cassio/.rvm/gems/ruby-2.0.0-p195@marazul/gems/activesupport-4.0.0/lib/active_support/json/decoding.rb:17:in `decode'
/home/cassio/.rvm/gems/ruby-2.0.0-p195@marazul/gems/spree_core-2.1.1/app/models/spree/image.rb:20:in `<class:Image>'
@cassioscabral
cassioscabral / gist:7795727
Created December 4, 2013 21:17
Error when I try to load the cart on spree 2.1.
Spree::Product::Translation Load (0.1ms) SELECT "spree_product_translations".* FROM "spree_product_translations" WHERE "spree_product_translations"."spree_product_id" = ? [["spree_product_id", 19]]
Rendered spree/orders/_line_item.html.erb (18.8ms)
Rendered spree/orders/_form.html.erb (78.5ms)
Rendered spree/orders/edit.html.erb within spree/layouts/spree_application (102.2ms)
Completed 500 Internal Server Error in 246ms
NoMethodError - undefined method `name' for #<Spree::LineItem:0x00000007f8b810>:
activemodel (4.0.0) lib/active_model/attribute_methods.rb:436:in `method_missing'
activerecord (4.0.0) lib/active_record/attribute_methods.rb:131:in `method_missing'
app/views/spree/orders/_line_item.html.erb:11:in `block in _af225cf8105137e3320093da7dfdc707'
Router.map(function () {
this.route('index', {
controller: 'BasicController',
layoutTemplate: 'indexLayout',
path: '/',
waitOn: function () {
return Meteor.subscribe('Channels');
}
});

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh [email protected]

Add ssh fingerprint and enter password provided in email

@cassioscabral
cassioscabral / meteor_live_templates.md
Last active August 29, 2015 14:05
Meteor Live Templates for Webstorm

As suggested in this question(that I asked) on SO. You can use some functions to create live templates on Webstorm(JetBrains IDEs).

Here I am adding my own live templates(calling snippet for short):

For creating templates:

Type: temp Add to: HTML

Expressions($VARIABLE$ : EXPRESSION):

Using Meld merging tool on Mac

  1. Install XQuartz

  2. Install meld with brew

     brew install meld
    
  3. Copy PYTHONPATH

#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@cassioscabral
cassioscabral / programming_languages.css
Created January 11, 2015 05:38
Github programming languages colors in Hex
.ags-script-color {
background: #B9D9FF;
}
.antlr-color {
background: #9DC3FF;
}