Skip to content

Instantly share code, notes, and snippets.

View cassioscabral's full-sized avatar

Cassio Cabral cassioscabral

View GitHub Profile

Using Meld merging tool on Mac

  1. Install XQuartz

  2. Install meld with brew

     brew install meld
    
  3. Copy PYTHONPATH

@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):

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

Router.map(function () {
this.route('index', {
controller: 'BasicController',
layoutTemplate: 'indexLayout',
path: '/',
waitOn: function () {
return Meteor.subscribe('Channels');
}
});
@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'
@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>'
# encoding: utf-8
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )

In your view:

<%= link_to "Load more", posts_path(@posts, page: @posts.current_page+1), id: "load-more-posts", remote: true %>

In your controller:

respond_to :html, :js, only: [:index]

def index
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
@cassioscabral
cassioscabral / gitignore
Created October 8, 2013 17:07
gitignore common extensions
node_modules/
local_settings.py
settings_local.py
*.pyc
*.sqlite
/media
.DS_Store
/.idea/