Skip to content

Instantly share code, notes, and snippets.

View LucasKuhn's full-sized avatar
🧙‍♂️
Casting spells

Lucas Kuhn LucasKuhn

🧙‍♂️
Casting spells
  • Brazil
View GitHub Profile
<body>
<div></div>
<%= yield %>
</body>
```html
<body>
<div></div>
<%= yield %>
</body>
```
<body>
  <div></div>
  <%= yield %>
</body>
@LucasKuhn
LucasKuhn / gist:2cb7831be48180e458ff8ed1551fb3ff
Last active August 12, 2018 21:33
Actually usefull scaffold
rails g scaffold post title:string content:text --no-assets --no-stylesheets --no-fixture --no-test-framework --no-helper --no-jbuilder
invoke active_record
create db/migrate/20180812213144_create_posts.rb
create app/models/post.rb
invoke resource_route
route resources :posts
invoke scaffold_controller
create app/controllers/posts_controller.rb
invoke erb
create app/views/posts
rails -v
if not 5.2 -> gem install rails -v 5.2.0
ruby -v
if not 2.4.0 -> rbenv install 2.4.0
rails new myapp --database=postgresql
bundle install
bundle exec rake db:create
bundle exec rake db:migrate
Receber o index dos cards idéias
GET /ideas
Receber o index dos cards ações
GET /actions
Criar um novo card
POST /cards
parametros
title,
@LucasKuhn
LucasKuhn / Gemfile
Created January 22, 2019 16:18
SPREE - Reimbursment not working with Store Credits
source 'https://rubygems.org'
ruby '2.4.1'
gem 'rails', '~> 5.1.4' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'pg' # Use postgresql as the database for Active Record
gem 'sass-rails' # Use SCSS for stylesheets
gem 'uglifier' # Use Uglifier as compressor for JavaScript assets
gem 'coffee-rails' # Use CoffeeScript for .coffee assets and views
gem 'mini_racer'
gem 'spree_contact_us', :git => 'https://github.com/spree-contrib/spree_contact_us' # /contact-us page
def fitness_function(self):
fitness = self.score_route()
fitness_duplicates = self.score_duplicates()
fitness_final_position = self.penalize_final_position()
total_fitness = fitness + fitness_duplicates + fitness_final_position
return total_fitness
def penalize_final_position(self):
final_position = self.route[-1]
penalty = 0
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->