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
Pull Request Checklist | |
- [ ] Does not require additional reviewers: specialized expertise | |
- [ ] Check for logic errors | |
- [ ] Check for missing, broken, wrong tests | |
- [ ] Check if looked for missing indexes | |
- [ ] Check for database transactional consistency issues | |
- [ ] Check all log levels are correct | |
- [ ] Check level of log detail | |
- [ ] Check code organization |
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
@pytest.fixture(autouse=True) | |
def database_cleaner(): | |
db.session.begin() | |
yield | |
db.session.rollback() |
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
# Put this file under Rails.root /lib | |
class CssColourValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
return false unless value | |
record.errors[attribute] << (options[:message] || 'is not a valid CSS colour') unless ::HexadecimalColourValidator.matches?(value) or ::WebSafeColourValidator.matches?(value) | |
end | |
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
package lib | |
{ | |
/* | |
* AS3 Wrapper for jsonp | |
* Hack around flash's cross-domain security policy for | |
* loading json on remote servers. ONLY works when flash is in a browser. | |
* | |
* example: | |
* JSONP.get("http://api.twitter.com/statuses/user_timeline.json", | |
* "{screen_name:'puppybits', count:'1'}", |
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 DefiniteArticleHelper | |
def the | |
@the ||= DefiniteArticle.new | |
end | |
def push_context | |
@the_contexts ||= [] | |
@the_contexts.push(the.clone) | |
@the = nil | |
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
Scenario: User sees merchandise in the same order as the admin entered it | |
Given there is an artist | |
And the artist has a merchandise product | |
And the product has the following attributes: | |
| name | | |
| L | | |
| XL | | |
When I am on the product's page | |
Then I should see the attributes in the following order: | |
| name | |
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
" Execute open rspec buffer | |
" Thanks to Ian Smith-Heisters | |
function! RunSpec(args) | |
if exists("b:rails_root") | |
if filereadable(b:rails_root . "/Gemfile") | |
let spec = "bundle exec rspec" | |
elseif filereadable(b:rails_root . "/script/spec") | |
let spec = b:rails_root . "/script/spec" | |
else | |
let spec = "rspec" |
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
#default label => keyword sets | |
@campaign_keywords_label = Hash.new | |
@campaign.campaign_keywords_labels.each do |kcl| | |
@campaign_keywords_label[kcl.label_id] = kcl.keyword.value | |
end |