This file contains hidden or 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
<div data-controller="popper"> | |
<%= button_tag type: "button", data: { "popper-target": "element", action: "click->popper#show click@window->popper#hide" } do %> | |
<%= content_tag "div", id: "downvote-#{video.id}" do %> | |
<%= link_to downvote_video_path(video), method: :patch, | |
remote: true, | |
style: "display: flex; justify-content: center; align-items: center;" do %> | |
<% if current_user %> | |
<% if current_user.voted_down_on? video %> | |
<%= fa_icon "thumbs-down solid", text: "Dislike", | |
style: "font-size: 30px; margin: 0 10px;" %> |
This file contains hidden or 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
import { Controller } from 'stimulus' | |
export default class extends Controller { | |
static targets = ["button"] | |
static values = { source: String } | |
copy () { | |
debugger | |
navigator.clipboard.writeText(this.sourceValue) | |
this.copied() |
This file contains hidden or 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
// This file is automatically compiled by Webpack, along with any other files | |
// present in this directory. You're encouraged to place your actual application logic in | |
// a relevant structure within app/javascript and only use these pack files to reference | |
// that code so it'll be compiled. | |
require("@rails/ujs").start() | |
require("@rails/activestorage").start() | |
require("channels") | |
require("@hotwired/turbo-rails") |
This file contains hidden or 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
<%- if controller_name != 'sessions' %> | |
<%= link_to "Log in", new_session_path(resource_name) %><br /> | |
<% end %> | |
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> | |
<%= link_to "Create an account", new_registration_path(resource_name) %><br /> | |
<% end %> | |
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> | |
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br /> |
This file contains hidden or 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
// This file is automatically compiled by Webpack, along with any other files | |
// present in this directory. You're encouraged to place your actual application logic in | |
// a relevant structure within app/javascript and only use these pack files to reference | |
// that code so it'll be compiled. | |
require("@rails/ujs").start() | |
require("@rails/activestorage").start() | |
require("channels") | |
require("@hotwired/turbo-rails") | |
require("youtube-player") |
This file contains hidden or 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 Ahoy::Event < AhoyRecord | |
include Ahoy::QueryMethods | |
MIN_NUMBER_OF_VIEWS = ENV["MINIMUM_NUMBER_OF_VIEWS"] || 3 | |
belongs_to :visit | |
belongs_to :user, optional: true | |
class << self | |
def most_viewed_videos_by_month |
This file contains hidden or 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
<%= button_tag type: "button", | |
class: "videos-sortable-button", | |
data: { controller: "filter", | |
action: "filter#filter", | |
"filter-watched-value": "1" } do %> | |
<% if filtering_params["watched"] == "1" %> | |
<%= content_tag(:b, "Watched") %> | |
<% else %> | |
Watched | |
<% end %> |
This file contains hidden or 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
<div class="videos-sortable-container"> | |
<label> | |
Filters for you | |
</label> | |
<%= button_tag type: "button", | |
class: "videos-sortable-button", | |
data: { controller: "filter", | |
action: "filter#filter", | |
"filter-watched-value": "1", | |
"filter-user-id-value": current_user.id } do %> |
This file contains hidden or 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
irb(main):001:0> Video::YoutubeImport.from_video('S2c6TJTdDX0') | |
D, [2021-12-29T11:11:45.804188 #4] DEBUG -- : Video Load (2.4ms) SELECT "videos".* FROM "videos" WHERE "videos"."youtube_id" = $1 LIMIT $2 [["youtube_id", "S2c6TJTdDX0"], ["LIMIT", 1]] | |
D, [2021-12-29T11:11:46.036802 #4] DEBUG -- : Channel Load (1.5ms) SELECT "channels".* FROM "channels" WHERE "channels"."channel_id" = $1 LIMIT $2 [["channel_id", "UCW7HAK0wBGHo1Xv3PL-CCGw"], ["LIMIT", 1]] | |
D, [2021-12-29T11:11:46.052199 #4] DEBUG -- : TRANSACTION (0.6ms) BEGIN | |
D, [2021-12-29T11:11:46.053313 #4] DEBUG -- : Video Exists? (0.9ms) SELECT 1 AS one FROM "videos" WHERE "videos"."youtube_id" = $1 AND "videos"."id" != $2 LIMIT $3 [["youtube_id", "S2c6TJTdDX0"], ["id", 247706], ["LIMIT", 1]] | |
D, [2021-12-29T11:11:46.056040 #4] DEBUG -- : TRANSACTION (0.5ms) COMMIT | |
D, [2021-12-29T11:11:46.060362 #4] DEBUG -- : Leader Load (3.2ms) SELECT "leaders".* FROM "leaders" | |
D, [2021-12-29T11:11:46.158394 #4] DEBUG -- : Follower Load (4.0ms) SELECT |
This file contains hidden or 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 Video::MusicRecognition::AcrCloud | |
class << self | |
def fetch(youtube_id) | |
new(youtube_id).update_video | |
rescue StandardError => e | |
Rails.logger.warn "Video::MusicRecognition::AcrCloud no video found: #{e.backtrace.join("\n\t")}" | |
end | |
end | |
def initialize(youtube_id) |