...hour format, @: same, but in 12-hour am/pm format \n: newline \r: carriage return \\: backslash Colors & Styles colors have to be escaped (see General), color codes should be followed by...
...30m\]>\[\033[00m\] ' => ✔ mycomputer ~/projects/platforms master > _ # Arne's epic timestamped prompt with return status indicator and status-colored (green if fresh, or red if unstaged, or yellow if staged) git...
...which's expected name is hard coded. A popular example is extension_allowlist, which returns an array of strings and let's you only upload files that have a filename...
...Project.find_each do |project| project.recalculate_statistics! end Both find_in_batches and find_each return records ordered by ID because they need to be able to iterate in batches. Modern...
...your browser window for 10 seconds. The reason is that evaluate_script will always return a result. The return value will be converted back to Ruby objects, which in case...
...path(path, expires_at = 2.hours.from_now, allow_fuzzy_expiry: true, secret: Rails.application.secrets.url_signature_secret) return unless path uri = URI.parse(path) if allow_fuzzy_expiry expires_at = expires_at.end_of_hour...
...never create a new object in an implicit conversion method. This method should either return self or not be implemented at all. Obviously, this is the reason behind this recent...
}, "last_data_send_time" : null, tells me, that this process did not return any data to the client "path" : "/admin/search_user?query=4", shows me the request caused the...
To return non-HTML responses (like XLS spreadsheets), we usually use the respond_to do |format| format.xls do # send spreadsheet end end This is often, but not always the same...
...classic "unit tests" where you instantiate an object, call a method and observe its return value or side effects. Your MovieDB already uses the gem rspec-rails which has many...
If the given ID was not found, a redirect to /movies is returned. The HTTP status 307 is used for the redirect. The movies index shows a flash...
...redirect_to @movie # else # render 'new' # end render plain: params.inspect end Note that #inspect returns a human-readable representation of an object. All Ruby objects implement this. Submit the new...
...than calling other step definitions. Because you are using plain ruby, you can use return values, structured arguments (e.g. hash options), etc. I often have files like the session_steps.rb (below...
...The more tests you already have, the less useful an additional test becomes ("Diminishing returns"). Tests sometimes fail even though the code is fine, especially when the test is coupled...
...the component. Use Jasmine spies to mock the window.fetch() method, inspect its calls and return a promise for a Response...
...in a central place makes your code DRY. E.g. Movie.human_attribute_name(:title) will return the title translation from activerecord.attributes.movie.title. Browse through the locale files of a recent sample app...
...offense for rule "space-before-blocks" [#180343876] Fix ESLint offense for rule "no-useless-return" [#180343876] Add ESLint without any offenses
Class Rectangle with properties width and height. It offers an area method that returns the product of width and height. Write an average function that takes an arbitrary number...
...it will wait for any beforeunload to be handled before e.g. a page.refresh statement returns. That that this also applies to wrapped calls like accept_confirm { page.refresh }. Setting unhandled_prompt...
...order of test-writing and implementation is up to you. When you're done, return to writing the code. The specced thing now exists, so you can continue making that...
...function escapeHighASCII(string) { let unicodeEscape = (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, '0') return string.replace(/[^\x00-\x7F]/g, unicodeEscape) } Escaping high ASCII in Ruby def escape_high_ascii(string...
...Yarn requires Node.js 4.0 or higher to be installed. Check if command -v "node" returns a path and you load NVM before Yarn. This could look like this:
...POST session/1230859ba100e7b2e5472cfb5bdf94c3/execute 2020-01-02 00:00:03 INFO Selenium >>> http://127.0.0.1:9538/session/1230859ba100e7b2e5472cfb5bdf94c3/execute | {"script":"return arguments[0].matches(':disabled, select:disabled *')","args":[{"ELEMENT...
Note: In case a string does not match the pattern, .match will return nil. With Ruby 2.4 the result of .match can be transformed to a Hash with...
'fish' => nil, 'birds' => '1' } ] end let(:csv) { generate_csv(csv_data) } # This will return a CSV with one header row and four data rows
var key = keyValuePair[0]; var value = keyValuePair[1]; pdfInfo[key] = decodeURI(value); } } return pdfInfo; } If you want to place repeated content outside the header or footer area, I...