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
| package models.processing | |
| import com.itextpdf.text.io.RandomAccessSource | |
| import play.api.libs.ws._ | |
| import concurrent.Await | |
| import concurrent.duration._ | |
| class S3RandomStream(remoteUrl:String) extends RandomAccessSource { | |
| override def close(): Unit = {} | |
| override def get(position: Long): Int = { |
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
| object Experimental extends Controller { | |
| implicit def FiniteDuration2Long(value: FiniteDuration) = value.toMillis | |
| def test = Action { | |
| Ok(views.html.experimental.test(longCalculations)) | |
| } | |
| def longCalculations: String = { | |
| val future = flow { | |
| Thread.sleep(10.seconds) |
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
| class Publish::ProcessingTask < ProcessingTask | |
| attr_accessible :product, :action | |
| def action= action_name | |
| self.name = action_name | |
| end | |
| private | |
| def lookup_background_worker |
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
| @media screen and (max-width:780px) { | |
| .remix-ui { | |
| .remix-cart .cart.wrapper { | |
| .promo.for-intro { | |
| display: none !important; | |
| } | |
| } | |
| .drop-zone { | |
| font-size: 80%; |
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
| def star_for(rating, star_number) | |
| if rating > star_number | |
| 'empty.png' | |
| elsif rating > star_number - 1 | |
| 'half.png' | |
| else | |
| 'full.png' | |
| 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
| RSpec.configure do |config| | |
| config.before(:each, mailer: true) do | |
| ActionMailer::Base.deliveries.clear | |
| end | |
| RSpec::Matchers.define :send_email do | |
| chain :to do |target| | |
| @target = target | |
| 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
| git log --date=short --pretty=format:'%an%x09%ad%x09%s' | grep 'Anatoly Lapshin' | grep -E '(fix: )|(done: )' |
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
| # lib/ability.rb | |
| class Ability | |
| include CanCan::Ability | |
| def initialize(user) | |
| user ||= User.new # guest user (not logged in) | |
| case user.role | |
| when 'manager': | |
| can [:cancel, :delivery_initiated, :received], Order |
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
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
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 ::Fears | |
| mattr_accessor :enabled | |
| self.enabled = true | |
| class JustifiedException < ::RuntimeError | |
| end | |
| class Result | |
| attr_accessor :result | |
| def initialize result |