This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= | |
| form_for :book, routes.book_path(id: book.id), values: { book: book } do |f| | |
| div do | |
| f.text_field :title | |
| end | |
| end | |
| %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Web::Controllers::Books | |
| class Create | |
| def call(params) | |
| puts params[:book] # => {:title => "TDD"} | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'bundler/setup' | |
| require 'benchmark/ips' | |
| require 'lotus/utils/string' | |
| GC.disable | |
| ENGINE_TYPE = Lotus::Utils::String.new('Lotus::Assets::Compressors::Javascript').demodulize.classify.freeze | |
| ENGINE_NAME = :uglifier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'bundler/setup' | |
| require 'benchmark/ips' | |
| require 'lotus/utils/string' | |
| # Comparing | |
| =begin | |
| def rsub_tap(pattern, replacement) | |
| self.class.new(@string.dup).tap do |s| | |
| if i = rindex(pattern) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://rubygems.org' | |
| gem 'mail' | |
| gem 'broken_string_blank', git: 'https://gist.github.com/c7ec3b778631a5a038fc.git', require: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Gem::Specification.new do |s| | |
| s.name = 'broken_string_blank' | |
| s.version = '0.1.0' | |
| s.platform = Gem::Platform::RUBY | |
| s.author = 'Luca Guidi' | |
| s.email = 'me@lucaguidi.com' | |
| s.summary = 'Broken String#blank?' | |
| s.description = 'Demo' | |
| s.files = ['broken_string_blank.rb'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'bundler/setup' | |
| require 'lotus/model' | |
| require 'lotus/model/migrator' | |
| require 'pg' | |
| class Bicycle | |
| include Lotus::Entity | |
| attributes :parts | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'benchmark/ips' | |
| require 'allocation_stats' | |
| require 'lotus/utils/inflector' | |
| require 'inflecto' | |
| require 'active_support/inflector' | |
| GC.disable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| $:.unshift 'lib' | |
| require 'benchmark/ips' | |
| require 'lotus/utils/string' | |
| require 'active_support/all' | |
| GC.disable | |
| TEST_PLURALS = { | |
| "murex" => "murices", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Chapter 01 | |
| * RSpec: --test=rspec option for app generator | |
| Chapter 02 | |
| * Migrations: they are a work in progress. | |
| * Lotus comes with a filesystem adapter, which is a great tool for quick prototyping because it's schemaless. For the initial iteractions I use it and then switch to a relational database as soon it becomes painful to work with it. | |
| * I usually use top level entities and repositories, but this is up to the developer. | |
| Chapter 03 | |
| * It's lotus generate action web articles#show |