2015-10-21
- jennifer
- martym
def self.popular_this_week | |
Podcast. | |
joins(:downloads). | |
select("podcasts.*, COUNT(podcast_id) as download_count"). | |
where("downloads.created_at >= ?", 1.week.ago.utc). | |
group("podcasts.id"). | |
order("download_count DESC") | |
end |
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.
<% flash.each do |type, message| %> | |
<div class="alert <%= bootstrap_class_for(type) %> fade in"> | |
<button class="close" data-dismiss="alert">×</button> | |
<%= message %> | |
</div> | |
<% end %> |
inputs = %w[ | |
CollectionSelectInput | |
DateTimeInput | |
FileInput | |
GroupedCollectionSelectInput | |
NumericInput | |
PasswordInput | |
RangeInput | |
StringInput | |
TextInput |
The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.
You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.
#Some examples with lambdas | |
sum = ->(num_list) { num_list.reduce(:+) } | |
square = ->(number ) { number * number } | |
squares = ->(num_list) { num_list.map {|num| square.(num) } } | |
sum_squares = ->(num_list) { sum.(squares.(num_list)) } | |
square_sum = ->(num_list) { square.(sum.(num_list)) } | |
gem 'minitest' | |
require 'minitest/autorun' |