Skip to content

Instantly share code, notes, and snippets.

Noel Rappin noelrappin

Block or report user

Report or block noelrappin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View block1.rb
PriceCalculator do
it "returns the price of one item" do
calculator = PriceCalcuator.new(Item.new(price: 200))
expect(calcuator.calculate).to eq(200)
end
end
View block2.rb
PriceCalculator
def initialize(*items)
end
def calculate
200
end
end
View rubocop.yml
AllCops:
Exclude:
- "db/schema.rb" # You can't touch this
- ".bundle/**/*" # Auto-generated
- "bin/**/*" # Auto-generated
- "vendor/**/*" # We cannot solve the world's problems
TargetRubyVersion: 2.3
Rails:
Enabled: true
View rubocop.yml
# Rubocop file I use for book code
# Note, this is code I work on by myself, so some. things that I don't do I may not have covered
AllCops:
Exclude:
- "db/schema.rb"
- ".bundle/**/*"
- "bin/**/*"
- "vendor/**/*"
View editable.js
class Editable {
constructor(text) {
@text = text
@originalText = ""
@status = "notEditing"
}
startEdit {
@status = "editing"
View editable.elm
type Editable
= BeingEdited String String
| NotBeingEdited String
View edit_editable.elm
edit : Editable -> Editable
edit x =
case x of
BeingEdited old new ->
x
NotBeingEdited value ->
BeingEdited value value
View unedit_editable.elm
save : Editable -> Editable
save x =
case x of
BeingEdited _ new ->
NotBeingEdited new
NotBeingEdited _ ->
x
View using_editable.elm
displayEditable : Editable -> HTML
displayEditable editable =
case editable of
BeingEdited old new ->
textarea [] [ text new ]
NotBeingEdited value ->
div [] [ text value ]
View basic_configure.rb
RSpec.configure do |config|
config.before(:each, type: :system) do
driven_by :rack_test
end
config.before(:each, type: :system, js: true) do
driven_by :selenium_chrome_headless
end
end
You can’t perform that action at this time.