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
// | |
// NOTE: delete all lines beginning with '//' before using--the file | |
// will cause errors otherwise! | |
// | |
{ | |
// replace the following with a real uuid, as always | |
"uuid": "99999999-8888-7777-6666-555544443333", | |
"type": "Homework", | |
"title": "Quiz 1 Cheatsheet", | |
"set": "Personal Cheatsheets", |
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
<pl-question-panel> | |
Instructions on what makes a valid cheatsheet go here. | |
Name your cheatsheet "cheatsheet.pdf" and use the panel below to upload it. | |
</pl-question-panel> | |
<pl-file-upload file-names="cheatsheet.pdf"> | |
</pl-file-upload> |
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
{ | |
"uuid": "REPLACE WITH A UUID", | |
"type": "Homework", | |
"allowAccess": [ | |
{ | |
"mode": "Exam" | |
} | |
], | |
"title": "CBTF Orientation", | |
"set": "Practice Quiz", |
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
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
export PS1="\[\033[1;34m\]\w[\$(parse_git_branch)]$\[\033[0m\] " |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> RottenPotatoes! </title> | |
<link rel="stylesheet" href="https://getbootstrap.com/docs/4.0/dist/css/bootstrap.min.css"> | |
<%= javascript_include_tag :application %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<div class="container"> |
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
# it would be nice if we could do this: | |
inception = Movie.where(:title => 'Inception') | |
alice,bob = Moviegoer.find(alice_id, bob_id) | |
# alice likes Inception, bob less so | |
alice_review = Review.new(:potatoes => 4) | |
bob_review = Review.new(:potatoes => 3) | |
# a movie has many reviews: | |
inception.reviews = [alice_review, bob_review] | |
# a moviegoer has many reviews: | |
alice.reviews << alice_review |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> RottenPotatoes! </title> | |
<link rel="stylesheet" href="https://getbootstrap.com/docs/4.0/dist/css/bootstrap.min.css"> | |
<%= javascript_include_tag :application %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<div class="container"> |
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
# it would be nice if we could do this: | |
inception = Movie.where(:title => 'Inception') | |
alice,bob = Moviegoer.find(alice_id, bob_id) | |
# alice likes Inception, bob less so | |
alice_review = Review.new(:potatoes => 4) | |
bob_review = Review.new(:potatoes => 3) | |
# a movie has many reviews: | |
inception.reviews = [alice_review, bob_review] | |
# a moviegoer has many reviews: | |
alice.reviews << alice_review |
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 MoviesController < ApplicationController | |
def index | |
@movies = Movie.all | |
@top_5 = Movie.joins(:reviews).group('movie_id'). | |
order("AVG(potatoes) DESC").limit(5) | |
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
<!-- a cacheable partial for top movies --> | |
<%- cache('top_moviegoers') do %> | |
<ul id="topmovies"> | |
<%- @top_5.each do |movie| %> | |
<li> <%= movie.name %> </li> | |
<% end %> | |
</ul> | |
<% end %> |
NewerOlder