repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/jwa/rsa.rb
lib/jwt/jwa/rsa.rb
# frozen_string_literal: true module JWT module JWA # Implementation of the RSA family of algorithms class Rsa include JWT::JWA::SigningAlgorithm def initialize(alg) @alg = alg @digest = alg.sub('RS', 'SHA') end def sign(data:, signing_key:) raise_sign_error!...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/jwa/signing_algorithm.rb
lib/jwt/jwa/signing_algorithm.rb
# frozen_string_literal: true module JWT # JSON Web Algorithms module JWA # Base functionality for signing algorithms module SigningAlgorithm # Class methods for the SigningAlgorithm module module ClassMethods def register_algorithm(algo) ::JWT::JWA.register_algorithm(algo) ...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/jwa/hmac.rb
lib/jwt/jwa/hmac.rb
# frozen_string_literal: true module JWT module JWA # Implementation of the HMAC family of algorithms class Hmac include JWT::JWA::SigningAlgorithm def initialize(alg, digest) @alg = alg @digest = digest end def sign(data:, signing_key:) signing_key ||= '' ...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/jwa/ps.rb
lib/jwt/jwa/ps.rb
# frozen_string_literal: true module JWT module JWA # Implementation of the RSASSA-PSS family of algorithms class Ps include JWT::JWA::SigningAlgorithm def initialize(alg) @alg = alg @digest_algorithm = alg.sub('PS', 'sha') end def sign(data:, signing_key:) r...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/jwa/none.rb
lib/jwt/jwa/none.rb
# frozen_string_literal: true module JWT module JWA # Implementation of the none algorithm class None include JWT::JWA::SigningAlgorithm def initialize @alg = 'none' end def sign(*) '' end def verify(*) true end register_algorithm(ne...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/jwa/unsupported.rb
lib/jwt/jwa/unsupported.rb
# frozen_string_literal: true module JWT module JWA # Represents an unsupported algorithm module Unsupported class << self include JWT::JWA::SigningAlgorithm def sign(*) raise_sign_error!('Unsupported signing method') end def verify(*) raise JWT::Ve...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/jwa/ecdsa.rb
lib/jwt/jwa/ecdsa.rb
# frozen_string_literal: true module JWT module JWA # ECDSA signing algorithm class Ecdsa include JWT::JWA::SigningAlgorithm def initialize(alg, digest) @alg = alg @digest = digest end def sign(data:, signing_key:) raise_sign_error!("The given key is a #{sign...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/not_before.rb
lib/jwt/claims/not_before.rb
# frozen_string_literal: true module JWT module Claims # The NotBefore class is responsible for validating the 'nbf' (Not Before) claim in a JWT token. class NotBefore # Initializes a new NotBefore instance. # # @param leeway [Integer] the amount of leeway (in seconds) to allow when validat...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/decode_verifier.rb
lib/jwt/claims/decode_verifier.rb
# frozen_string_literal: true module JWT module Claims # Context class to contain the data passed to individual claim validators # # @api private VerificationContext = Struct.new(:payload, keyword_init: true) # Verifiers to support the ::JWT.decode method # # @api private module Deco...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/issuer.rb
lib/jwt/claims/issuer.rb
# frozen_string_literal: true module JWT module Claims # The Issuer class is responsible for validating the issuer claim ('iss') in a JWT token. class Issuer # Initializes a new Issuer instance. # # @param issuers [String, Symbol, Array<String, Symbol>] the expected issuer(s) for the JWT to...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/required.rb
lib/jwt/claims/required.rb
# frozen_string_literal: true module JWT module Claims # The Required class is responsible for validating that all required claims are present in a JWT token. class Required # Initializes a new Required instance. # # @param required_claims [Array<String>] the list of required claims. ...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/verifier.rb
lib/jwt/claims/verifier.rb
# frozen_string_literal: true module JWT module Claims # @api private module Verifier VERIFIERS = { exp: ->(options) { Claims::Expiration.new(leeway: options.dig(:exp, :leeway)) }, nbf: ->(options) { Claims::NotBefore.new(leeway: options.dig(:nbf, :leeway)) }, iss: ->(options) {...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/jwt_id.rb
lib/jwt/claims/jwt_id.rb
# frozen_string_literal: true module JWT module Claims # The JwtId class is responsible for validating the JWT ID claim ('jti') in a JWT token. class JwtId # Initializes a new JwtId instance. # # @param validator [#call] an object responding to `call` to validate the JWT ID. def initi...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/issued_at.rb
lib/jwt/claims/issued_at.rb
# frozen_string_literal: true module JWT module Claims # The IssuedAt class is responsible for validating the issued at claim ('iat') in a JWT token. class IssuedAt # Verifies the issued at claim ('iat') in the JWT token. # # @param context [Object] the context containing the JWT payload. ...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/crit.rb
lib/jwt/claims/crit.rb
# frozen_string_literal: true module JWT module Claims # Responsible of validation the crit header class Crit # Initializes a new Crit instance. # # @param expected_crits [String] the expected crit header values for the JWT token. def initialize(expected_crits:) @expected_crit...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/subject.rb
lib/jwt/claims/subject.rb
# frozen_string_literal: true module JWT module Claims # The Subject class is responsible for validating the subject claim ('sub') in a JWT token. class Subject # Initializes a new Subject instance. # # @param expected_subject [String] the expected subject for the JWT token. def initi...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/expiration.rb
lib/jwt/claims/expiration.rb
# frozen_string_literal: true module JWT module Claims # The Expiration class is responsible for validating the expiration claim ('exp') in a JWT token. class Expiration # Initializes a new Expiration instance. # # @param leeway [Integer] the amount of leeway (in seconds) to allow when vali...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/audience.rb
lib/jwt/claims/audience.rb
# frozen_string_literal: true module JWT module Claims # The Audience class is responsible for validating the audience claim ('aud') in a JWT token. class Audience # Initializes a new Audience instance. # # @param expected_audience [String, Array<String>] the expected audience(s) for the JW...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
jwt/ruby-jwt
https://github.com/jwt/ruby-jwt/blob/7af2ac0e36455b94543e47c3e042e9835b247965/lib/jwt/claims/numeric.rb
lib/jwt/claims/numeric.rb
# frozen_string_literal: true module JWT module Claims # The Numeric class is responsible for validating numeric claims in a JWT token. # The numeric claims are: exp, iat and nbf class Numeric # List of numeric claims that can be validated. NUMERIC_CLAIMS = %i[ exp iat ...
ruby
MIT
7af2ac0e36455b94543e47c3e042e9835b247965
2026-01-04T15:49:29.397481Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/jobs/destroy_expired_lesson_previews_job.rb
app/jobs/destroy_expired_lesson_previews_job.rb
class DestroyExpiredLessonPreviewsJob < ApplicationJob def perform LessonPreview.expired.each(&:destroy) end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/jobs/application_job.rb
app/jobs/application_job.rb
class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked # Most jobs are safe to ignore if the underlying records are no longer available # discard_on ActiveJob::DeserializationError end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/jobs/discard_project_submission_job.rb
app/jobs/discard_project_submission_job.rb
class DiscardProjectSubmissionJob < ApplicationJob def perform ProjectSubmission.discardable.each(&:discard!) end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/jobs/refresh_materialized_views_job.rb
app/jobs/refresh_materialized_views_job.rb
class RefreshMaterializedViewsJob < ApplicationJob queue_as :default def perform [ Reports::AllLessonCompletionsDayStat, Reports::PathLessonCompletionsDayStat, Reports::UserSignUpsDayStat ].each(&:refresh) end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/jobs/lessons/import_all_content_job.rb
app/jobs/lessons/import_all_content_job.rb
module Lessons class ImportAllContentJob < ApplicationJob def perform Github::LessonContentImporter.import_all end end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/jobs/lessons/update_content_job.rb
app/jobs/lessons/update_content_job.rb
module Lessons class UpdateContentJob < ApplicationJob def perform(github_paths) lessons = Lesson.where(github_path: github_paths) lessons.each(&:import_content_from_github) end end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/markdown_converter.rb
app/services/markdown_converter.rb
require './lib/kramdown/document_sections' require './lib/kramdown/converter/odin_html' class MarkdownConverter def initialize(markdown) @markdown = markdown end def as_html sections = Kramdown::DocumentSections.new(markdown).all_sections if sections.any? sections.map { |section| parse_with_g...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/next_lesson.rb
app/services/next_lesson.rb
class NextLesson def initialize(course, lesson_completions) @course = course @lesson_completions = lesson_completions end def to_complete next_uncompleted_lesson || remaining_lessons_to_complete.first end private attr_reader :course, :lesson_completions def next_uncompleted_lesson rema...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/course_progress.rb
app/services/course_progress.rb
class CourseProgress def initialize(course, user) @course = course @user = user end def started? completed_lessons.positive? end def completed? pending_lessons.zero? end def percentage (completed_lessons * 100.0 / total_lessons).to_i end private attr_reader :course, :user ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/discord_notifier.rb
app/services/discord_notifier.rb
class DiscordNotifier def initialize(notification) @notification = notification end def self.notify(notification) new(notification).notify end def notify client.execute do |builder| builder.content = notification.message end end private attr_reader :notification def client ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/project_submissions/mark_liked.rb
app/services/project_submissions/mark_liked.rb
module ProjectSubmissions class MarkLiked def initialize(user:, project_submissions:) @user = user @project_submissions = project_submissions end def self.call(**) new(**).call end def call project_submissions.each do |submission| next if liked_submission_ids.excl...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/messages/dead_link.rb
app/services/messages/dead_link.rb
module Messages class DeadLink include Rails.application.routes.url_helpers attr_reader :flag def initialize(flag) @flag = flag end def title "One of your submissions has been flagged on #{flagged_date}" end def content "Hey #{username}, your project #{lesson_name} ha...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/users/reset_progress.rb
app/services/users/reset_progress.rb
module Users class ResetProgress def initialize(user) @user = user @success = false end def self.call(user) new(user).call end def call user.transaction do delete_lesson_completions reset_default_path unless user.path.default_path? @success = true ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/notifications/daily_summary.rb
app/services/notifications/daily_summary.rb
module Notifications class DailySummary def message "**TOP Summary For #{Date.yesterday.to_fs(:long_ordinal)} (UTC)**\n" \ "#{user_sign_up_count} users signed up\n" \ "#{lesson_completion_count} lessons completed\n" \ "#{project_submission_count} project submissions added\n" \ ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/notifications/flag_submission.rb
app/services/notifications/flag_submission.rb
module Notifications class FlagSubmission include Rails.application.routes.url_helpers delegate :flagger, :project_submission, :reason, :extra, to: :flag, private: true def initialize(flag) @flag = flag end def message "#{flagger.username} has flagged a submission on #{project_submi...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/services/courses/mark_completed_lessons.rb
app/services/courses/mark_completed_lessons.rb
module Courses class MarkCompletedLessons def initialize(user:, lessons:) @user = user @lessons = lessons end def self.call(user:, lessons:) new(user:, lessons:).call end def call lessons.each do |lesson| next if completed_lesson_ids.exclude?(lesson.id) l...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/adaptors/feature.rb
app/adaptors/feature.rb
class Feature def self.enabled?(name, actor) Flipper.enabled?(name.to_sym, actor) end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/helpers/lessons_helper.rb
app/helpers/lessons_helper.rb
module LessonsHelper def github_edit_url(lesson) github_link("curriculum/edit/main#{lesson.github_path}") end def github_commits_url(lesson) github_link("curriculum/commits/main#{lesson.github_path}") end def github_report_url(lesson) params = { labels: 'Status: Needs Triage', templa...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/helpers/qr_code_helper.rb
app/helpers/qr_code_helper.rb
module QrCodeHelper def qr_code_as_svg(uri) RQRCode::QRCode.new(uri).as_svg( offset: 0, color: '000', shape_rendering: 'crispEdges', module_size: 4, standalone: true, viewbox: true ) end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/helpers/button_helper.rb
app/helpers/button_helper.rb
module ButtonHelper def sign_up_button link_to 'Sign up', sign_up_path, class: 'button button--primary' end def curriculum_button link_to 'View curriculum', paths_path, class: 'button button--primary text-base' end def contribute_button link_to 'Learn how to contribute', contributing_path, class...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/helpers/application_helper.rb
app/helpers/application_helper.rb
module ApplicationHelper require 'kramdown' include Pagy::Frontend def github_link(extension = '') "https://github.com/TheOdinProject/#{extension}" end def title(input = nil) content_for(:title) { "#{input} | The Odin Project" } if input end def sign_up_or_view_curriculum_button if current_...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/helpers/announcement_helper.rb
app/helpers/announcement_helper.rb
module AnnouncementHelper def disabled_announcement_ids announcement_cookies.filter_map { |cookie| cookie[1].to_i } end private def announcement_cookies cookies.filter_map { |name, _| name.match(/^announcement_(\d+)/) }.compact end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/policies/admin_user_policy.rb
app/policies/admin_user_policy.rb
class AdminUserPolicy def initialize(admin_user) @admin_user = admin_user end def change_role? admin_user.core? end def invite? admin_user.core? || admin_user.maintainer? end def deactivate? admin_user.core? end def reactivate? admin_user.core? || admin_user.maintainer? end ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/policies/submission_like_policy.rb
app/policies/submission_like_policy.rb
class SubmissionLikePolicy def initialize(user) @user = user end def allowed? return true if @user.project_submissions.any? no_recent_accounts_with_same_ip? end private def no_recent_accounts_with_same_ip? User .created_after(1.week.ago) .where(last_sign_in_ip: @user.current_...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/validators/url_validator.rb
app/validators/url_validator.rb
class UrlValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) message = options[:message] || 'Must be a valid URL' record.errors.add(attribute, message) unless url_valid?(value) end # rubocop:disable Style/RescueModifier def url_valid?(url) url = URI.parse(url) rescue ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/interview_surveys_controller.rb
app/controllers/interview_surveys_controller.rb
class InterviewSurveysController < ApplicationController requires_feature :survey_feature def new; end def create # puts params[:survey] redirect_to dashboard_path, notice: 'Survey Submitted' end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/courses_controller.rb
app/controllers/courses_controller.rb
class CoursesController < ApplicationController before_action :set_cache_control_header_to_no_store def show @path = Path.find(params[:path_id]) @course = @path.courses.friendly.find(params[:id]) @sections = @course.sections.includes(:lessons) mark_completed_lessons end private def mark_co...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/sitemap_controller.rb
app/controllers/sitemap_controller.rb
class SitemapController < ApplicationController def index @static_pages = static_pages @courses = Course.all respond_to do |format| format.xml end end private def static_pages [root_url, about_url, faq_url, sign_in_url, sign_up_url].freeze end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/notifications_controller.rb
app/controllers/notifications_controller.rb
class NotificationsController < ApplicationController before_action :authenticate_user! def index @notifications = current_user.notifications end def update notification = current_user.notifications.find(params[:id]) if notification.mark_as_read! redirect_to notification.url else ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/themes_controller.rb
app/controllers/themes_controller.rb
class ThemesController < ApplicationController before_action :cache_previous_theme def update @new_theme = Users::Theme.for(params[:theme]) respond_to do |format| if @new_theme.present? change_current_theme(params[:theme]) format.turbo_stream else flash.now[:alert] = "...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/static_pages_controller.rb
app/controllers/static_pages_controller.rb
class StaticPagesController < ApplicationController def home @landing_page = true @success_stories = SuccessStory.limit(4) @courses = Course.badges end def about; end def faq; end def team; end def terms_of_use; end def privacy_policy; end def success_stories @success_stories = Suc...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/lessons_controller.rb
app/controllers/lessons_controller.rb
class LessonsController < ApplicationController before_action :set_cache_control_header_to_no_store def show @lesson = Lesson.find(params[:id]) if user_signed_in? @project_submission = current_user.project_submissions.find_by(lesson: @lesson) Courses::MarkCompletedLessons.call(user: current_us...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users_controller.rb
app/controllers/users_controller.rb
class UsersController < ApplicationController before_action :authenticate_user! def show @courses = current_user.path.courses @project_submissions = current_user.project_submissions.includes(:lesson).order(created_at: :desc) end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/errors_controller.rb
app/controllers/errors_controller.rb
class ErrorsController < ActionController::Base # rubocop:disable Rails/ApplicationController def not_found render status: :not_found end def unprocessable_entity render status: :unprocessable_entity end def internal_server_error render status: :internal_server_error end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/paths_controller.rb
app/controllers/paths_controller.rb
class PathsController < ApplicationController def index @foundations = Path.default_path @fullstack_paths = Path.fullstack_paths end def show @path = Path.friendly.find(params[:id]) if @path.courses.size == 1 redirect_to path_course_path(@path, @path.courses.first) end end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/application_controller.rb
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base include CurrentTheme include Pagy::Backend extend RequiresFeature before_action :configure_permitted_parameters, if: :devise_controller? before_action :set_sentry_user, if: :current_user before_action :store_user_location!, if: :storable_location? res...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/concerns/current_theme.rb
app/controllers/concerns/current_theme.rb
module CurrentTheme extend ActiveSupport::Concern included do before_action :set_default helper_method :current_theme end private def set_default return if cookies[:theme].present? cookies.permanent[:theme] = 'light' end def change_current_theme(theme) cookies.permanent[:theme] =...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/concerns/two_factor_authentication.rb
app/controllers/concerns/two_factor_authentication.rb
module TwoFactorAuthentication extend ActiveSupport::Concern included do before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create] end private def two_factor_enabled? resource = find_resource resource&.two_factor_enabled? end def authenticate_with_two_factor ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/concerns/requires_feature.rb
app/controllers/concerns/requires_feature.rb
module RequiresFeature def requires_feature(name, **) before_action( lambda do return if Feature.enabled?(name, current_user) redirect_to dashboard_path, notice: 'Feature not enabled' end, ** ) end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/concerns/sortable.rb
app/controllers/concerns/sortable.rb
module Sortable extend ActiveSupport::Concern def sort_column_for(klass) params[:sort].presence_in(klass.sortable_columns) || 'created_at' end def sort_direction(default: 'desc') params[:direction].presence_in(%w[asc desc]) || default end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/project_submissions/likes_controller.rb
app/controllers/project_submissions/likes_controller.rb
class ProjectSubmissions::LikesController < ApplicationController before_action :authenticate_user! before_action :authorize_like def update @project_submission = ProjectSubmission.find(params[:project_submission_id]) if @project_submission.liked_by?(current_user) @project_submission.unlike(curren...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/project_submissions/flags_controller.rb
app/controllers/project_submissions/flags_controller.rb
class ProjectSubmissions::FlagsController < ApplicationController before_action :authenticate_user! before_action :set_project_submission def new @flag = @project_submission.flags.new end def create @flag = @project_submission.flags.new(flag_params) respond_to do |format| if @flag.save ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/lessons/previews_controller.rb
app/controllers/lessons/previews_controller.rb
module Lessons class PreviewsController < ApplicationController def show @preview = LessonPreview.find_or_initialize_by(id: params[:uuid]) end def create @preview = LessonPreview.new(content: params[:markdown]) respond_to do |format| format.turbo_stream end end end ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/lessons/project_submissions_controller.rb
app/controllers/lessons/project_submissions_controller.rb
module Lessons class ProjectSubmissionsController < ApplicationController include Sortable before_action :authenticate_user! before_action :set_lesson before_action :can_add_solution def index project_submissions = @lesson .project_submissions .only_public .sort_by_...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/lessons/completions_controller.rb
app/controllers/lessons/completions_controller.rb
module Lessons class CompletionsController < ApplicationController before_action :authenticate_user! # rubocop: disable Metrics/MethodLength def create @lesson = Lesson.find(params[:lesson_id]) lesson_completion = current_user.lesson_completions.find_or_create_by!( lesson: @lesson, ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/lessons/previews/share_controller.rb
app/controllers/lessons/previews/share_controller.rb
module Lessons module Previews class ShareController < ApplicationController def create @preview = LessonPreview.new(content: params[:content]) respond_to do |format| if @preview.save format.turbo_stream else flash.now[:alert] = 'Unable to share p...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/github/webhooks_controller.rb
app/controllers/github/webhooks_controller.rb
class Github::WebhooksController < ApplicationController include GithubWebhook::Processor skip_before_action :verify_authenticity_token def github_push(payload) event = ::Github::PushEvent.new(payload) Lessons::UpdateContentJob.perform_later(event.modified_urls) if event.merged_to_main? end privat...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/two_factor_authentication_controller.rb
app/controllers/admin/two_factor_authentication_controller.rb
module Admin class TwoFactorAuthenticationController < Admin::BaseController skip_before_action :ensure_two_factor_enabled def new if current_admin_user.two_factor_enabled? redirect_to admin_dashboard_path, status: :see_other, alert: 'Two factor authentication is already enabled.' retur...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/learners_controller.rb
app/controllers/admin/learners_controller.rb
module Admin class LearnersController < Admin::BaseController before_action :authorize_admin, only: %i[destroy] def index if params[:search_term].present? @pagy, @learners = pagy(User.search_by(params[:search_term]), items: 20) else @pagy, @learners = pagy(User.all, items: 20) ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/dashboard_controller.rb
app/controllers/admin/dashboard_controller.rb
module Admin class DashboardController < Admin::BaseController def show @active_flags_count = Flag.count_for(:active) @active_announcements_count = Announcement.active.count end end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members_controller.rb
app/controllers/admin/team_members_controller.rb
module Admin class TeamMembersController < Admin::BaseController def index @pending_team_members = AdminUser.awaiting_activation.ordered @active_team_members = AdminUser.activated.ordered @deactivated_team_members = AdminUser.deactivated.ordered end def destroy # rubocop:disable Metrics...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/passwords_controller.rb
app/controllers/admin/passwords_controller.rb
module Admin class PasswordsController < Devise::PasswordsController def new redirect_to new_admin_user_session_path, alert: 'Please sign in' end def create redirect_to new_admin_user_session_path, alert: 'Please sign in' end private def after_resetting_password_path_for(_resour...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/announcements_controller.rb
app/controllers/admin/announcements_controller.rb
module Admin class AnnouncementsController < Admin::BaseController def index @pagy, @announcements = pagy(Announcement .for_status(params.fetch(:status, :active)) .ordered_by_recent, items: 20) end def show @announcement = Announcement.find(params[:id]) end def new ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/invitations_controller.rb
app/controllers/admin/invitations_controller.rb
module Admin class InvitationsController < Devise::InvitationsController before_action :authorize_admin, only: %i[new create] # rubocop:disable Rails/LexicallyScopedActionFilter before_action :configure_permitted_parameters after_action :create_invited_activity, only: :create def create self.re...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/base_controller.rb
app/controllers/admin/base_controller.rb
# rubocop:disable Rails/ApplicationController module Admin class BaseController < ActionController::Base include Pagy::Backend include CurrentTheme before_action :authenticate_admin_user! before_action :ensure_two_factor_enabled, if: :current_admin_user before_action :set_current_admin_user ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/profile_controller.rb
app/controllers/admin/profile_controller.rb
module Admin class ProfileController < Admin::BaseController def edit # Use a separate admin user instance to avoid morphing current admin when valildation fails @admin_user = AdminUser.find(current_admin_user.id) end def update @admin_user = AdminUser.find(current_admin_user.id) ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/sessions_controller.rb
app/controllers/admin/sessions_controller.rb
module Admin class SessionsController < Devise::SessionsController include TwoFactorAuthentication before_action :configure_permitted_parameters, if: :devise_controller? private def after_sign_in_path_for(_resource) admin_dashboard_path end def after_sign_out_path_for(_resource_or_sc...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/flags_controller.rb
app/controllers/admin/flags_controller.rb
module Admin class FlagsController < Admin::BaseController def index @pagy, @flags = pagy(Flag.by_status(params.fetch(:status, 'active')).ordered_by_most_recent, items: 20) end def show @flag = Flag.find(params[:id]) end def update @flag = Flag.find(params[:id]) action = ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/reports/lesson_completions_controller.rb
app/controllers/admin/reports/lesson_completions_controller.rb
module Admin class Reports::LessonCompletionsController < Admin::BaseController before_action :set_date_range, only: :show def show @lesson_completions_stats = ::Reports::AllLessonCompletionsDayStat .for_date_range(@start, @end) .group_by_period(period.name) end private de...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/reports/users_controller.rb
app/controllers/admin/reports/users_controller.rb
module Admin class Reports::UsersController < Admin::BaseController before_action :set_date_range, only: :index def index @sign_up_stats = ::Reports::UserSignUpsDayStat .for_date_range(@start, @end) .group_by_period(period.name) end private def set_date_range @earlie...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/reports/paths_controller.rb
app/controllers/admin/reports/paths_controller.rb
module Admin class Reports::PathsController < Admin::BaseController before_action :set_date_range, only: :show def show @path = Path.find(params[:id]) @path_lesson_completions = @path.lesson_completion_stats .filter_by_course(params[:course_id]) .for_date_range(@start, @end) ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members/deactivation_controller.rb
app/controllers/admin/team_members/deactivation_controller.rb
module Admin class TeamMembers::DeactivationController < Admin::BaseController before_action :authorize_admin rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def update team_member = AdminUser.find(params[:team_member_id]) team_member.deactivate! redirect_to admin_te...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members/reactivation_controller.rb
app/controllers/admin/team_members/reactivation_controller.rb
module Admin class TeamMembers::ReactivationController < Admin::BaseController before_action :authorize_admin rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def update team_member = AdminUser.find(params[:team_member_id]) team_member.reactivate! team_member.reset_two...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members/two_factor_reset_controller.rb
app/controllers/admin/team_members/two_factor_reset_controller.rb
module Admin class TeamMembers::TwoFactorResetController < Admin::BaseController before_action :authorize_admin rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def update team_member = AdminUser.find(params[:team_member_id]) team_member.reset_two_factor! team_member.p...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members/resend_invitation_controller.rb
app/controllers/admin/team_members/resend_invitation_controller.rb
module Admin class TeamMembers::ResendInvitationController < Admin::BaseController rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def create # rubocop:disable Metrics/MethodLength team_member = AdminUser.find(params[:team_member_id]) if team_member.awaiting_activation? ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members/password_resets_controller.rb
app/controllers/admin/team_members/password_resets_controller.rb
module Admin class TeamMembers::PasswordResetsController < Admin::BaseController rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def create team_member = AdminUser.find(params[:team_member_id]) team_member.send_reset_password_instructions team_member.create_activity(key: ...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members/activities_controller.rb
app/controllers/admin/team_members/activities_controller.rb
module Admin class TeamMembers::ActivitiesController < Admin::BaseController def index @activities = PublicActivity::Activity.where(trackable_type: 'AdminUser').order(created_at: :desc) end end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/team_members/role_controller.rb
app/controllers/admin/team_members/role_controller.rb
module Admin class TeamMembers::RoleController < Admin::BaseController before_action :authorize_admin rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def edit @team_member = AdminUser.find(params[:team_member_id]) end def update @team_member = AdminUser.find(params...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/admin/profile/password_controller.rb
app/controllers/admin/profile/password_controller.rb
module Admin class Profile::PasswordController < Admin::BaseController def update @admin_user = AdminUser.find(current_admin_user.id) if @admin_user.update_with_password(password_params) # Sign in the user by passing validation in case their password changed bypass_sign_in(@admin_user...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/api/points_controller.rb
app/controllers/api/points_controller.rb
class Api::PointsController < ApplicationController skip_before_action :verify_authenticity_token before_action :authenticate def index render json: Point.order(points: :desc).limit(params[:limit]).offset(params[:offset]) end def show user_points = Point.find_by(discord_id: params[:id]) if user...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users/profiles_controller.rb
app/controllers/users/profiles_controller.rb
module Users class ProfilesController < ApplicationController before_action :authenticate_user! def edit; end def update if current_user.update(user_params) redirect_to edit_users_profile_path, notice: 'Your account has been updated' else render :edit, status: :unprocessable_...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users/omniauth_callbacks_controller.rb
app/controllers/users/omniauth_callbacks_controller.rb
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def github @user = UserProvider.find_user(auth) update_users_avatar if avatar_needs_updated? if @user.persisted? @user.remember_me = true sign_in_and_redirect @user else session['devise.github_data'] = a...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users/password_resets_controller.rb
app/controllers/users/password_resets_controller.rb
class Users::PasswordResetsController < Devise::PasswordsController end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users/registrations_controller.rb
app/controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController protected def after_sign_up_path_for(_resource) dashboard_path end def after_inactive_sign_up_path_for(_resource) dashboard_path end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users/progress_controller.rb
app/controllers/users/progress_controller.rb
module Users class ProgressController < ApplicationController before_action :authenticate_user! def destroy result = Users::ResetProgress.call(current_user) if result.success? redirect_to edit_users_profile_path, notice: 'Success: Your progress has been reset.' else redirect...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users/paths_controller.rb
app/controllers/users/paths_controller.rb
module Users class PathsController < ApplicationController before_action :authenticate_user! rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def create if current_user.update(path:) redirect_to path, notice: "You have selected the #{path.title} path" else red...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/users/sessions_controller.rb
app/controllers/users/sessions_controller.rb
class Users::SessionsController < Devise::SessionsController end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/guides/community_controller.rb
app/controllers/guides/community_controller.rb
module Guides class CommunityController < ApplicationController Guide = Data.define(:title, :path) def show @guides = guides.map { |title, path| Guide.new(title:, path:) } end private def guides { 'Rules' => rules_guides_community_path, 'Expectations' => expectations...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/guides/installations_controller.rb
app/controllers/guides/installations_controller.rb
module Guides class InstallationsController < ApplicationController def index @lessons_by_path = Lesson .installation_lessons .sort_by { |lesson| [lesson.course.position, lesson.path.position] } .group_by(&:path) end end end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/controllers/courses/progress_controller.rb
app/controllers/courses/progress_controller.rb
module Courses class ProgressController < ApplicationController before_action :authenticate_user! before_action :course, only: :show before_action :progress_options, only: :show def show @percentage = @course.progress_for(current_user).percentage end private def course @cour...
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/app/components/announcement_component.rb
app/components/announcement_component.rb
class AnnouncementComponent < ApplicationComponent def initialize(announcement:, closeable: true) @announcement = announcement @closeable = closeable end def render? announcement.present? end private attr_reader :announcement, :closeable end
ruby
MIT
bc97027b6e48d5197a4e88f4b05b9c4341c19b3a
2026-01-04T15:46:55.521218Z
false