This file contains 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
/*: | |
# Swift Protocol Generics | |
In reference to [Secret Projects Diary #2: Swift 2.0 Protocols](http://inessential.com/2015/07/19/secret_projects_diary_2_swift_2_0_prot): | |
An variable of type `[Feed]` means that it could have a `LocalFeed` and a `FeedlyFeed`, which may be intentional, but i think not in this case. I am assuming that the `FeedlyFolder` could be typed as `[FeedlyFeed]`. If that is the case, making the Folder protocol be generic with a constraint of Feed should do the trick. | |
*/ | |
import Cocoa |
This file contains 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 ApplicationHelper | |
def polymorphic_render(resource, suffix = nil, options = {}) | |
if resource.nil? | |
return | |
elsif resource.is_a? Array | |
capture do | |
resource.each { |res| concat polymorphic_render(res, suffix, options) } | |
end | |
elsif resource.respond_to? :to_partial_path | |
path = [resource.to_partial_path, *Array(suffix)].compact_blank.join('_') |
This file contains 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
def click_nav(label) | |
within "#desktop-nav" do | |
click_on label | |
end | |
end | |
scenario "navigate to projects page" do | |
click_nav "Projects" | |
expect(page).to have_content "Projects" | |
end |
This file contains 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
workbook = RubyXL::Workbook.new | |
worksheet = workbook.worksheets[0] | |
# Style to highlight red | |
style = RubyXL::DXF.new | |
style.font = RubyXL::Font.new | |
style.font.color = RubyXL::Color.new("FF0000") | |
# Add style to workbook | |
workbook.stylesheet.dxfs ||= RubyXL::DXFs.new # This was my initial problem |
This file contains 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
<head> | |
<!-- other head content --> | |
<%= turbo_refreshes_with method: :morph, scroll: :preserve %> | |
<%= content_for :head %> | |
</head> |
This file contains 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
class NewPostNotification < Noticed::Base | |
# ... other deliver methods | |
deliver_by :web_push, data_method: :web_push_data | |
def web_push_data | |
{ | |
title: "New post: #{post.title}", | |
body: post.content.truncate(40), | |
url: post_url(post), | |
} |
OlderNewer