Skip to content

Instantly share code, notes, and snippets.

View jmarsh24's full-sized avatar

Justin Marsh jmarsh24

View GitHub Profile
@jmarsh24
jmarsh24 / _filters.html.erb
Last active October 19, 2020 21:42
Choices.js only applying to a single select table when called multiple times.
<%= "#{@videos_filtered.count} Results" %>
<div data-controller="toggle">
<button type='submit' data-action="toggle#toggle" class="filter_button">
<i class="fas fa-filter fa-lg" aria-hidden="true"></i>
</button>
<div class="hidden" data-target="toggle.toggleable">
<%= form_for :video do |f| %>
<div data-controller="choices">
@jmarsh24
jmarsh24 / houndify.rb
Last active November 15, 2020 10:45
Houndify Sound Match
require "openssl"
require "securerandom"
require "net/http"
require "json"
require "base64"
module Houndify
attr_reader :secrets
def self.set_secrets(id, key)
@secrets = {
{
"status" => {
"msg" => "Success",
"code" => 0,
"version" => "1.0"
},
"metadata" => {
"music" => [
[0] {
"external_ids" => {},
class Video::AcrCloudImport::Parse
attr_reader :acr_response_code,
:spotify_album_id,
:spotify_album_name,
:spotify_album_name,
:spotify_artist,
:spotify_artist_1,
:spotify_artist_2,
:spotift_artist_name,
:spotift_artist_name_1,
<div class="loadMoreContainer">
<div class="loadMoreResults">
<%= "Displaying #{@page} / #{number_with_delimiter(@videos.size)} Results" %>
</div>
<% unless @next_page_items.empty? %>
<button class="load-more-link" data-action='click->loadmore#loadMore'>
Load More
</button>
<% end %>
</div>
<div data-controller="filter">
<div class="filter-header">
<div class="filter-container-button-results">
<button data-action="click->toggle#toggle" class="filter-button"><%= fa_icon "sliders-h 2x", left: true %>
<div id="filter-button-text">Filters</div>
</button>
<div id="filter_results">
<%= "Displaying #{number_with_delimiter(@videos.size)} Results" %>
</div>
</div>
<%= turbo_frame_tag dom_id(@video) do %>
<div class="video-info-details-main">
<h4>Performers</h4>
</div>
<%= render partial: "videos/show/video_info_item",
locals: { header: "Leader",
value: link_to(@video.leader.try(:name),
root_path(leader: @video.leader.name), {'data-turbo-frame': "_top"}) } if @video.leader.present? %>
<%= render partial: "videos/show/video_info_item",
locals: { header: "Follower",
(byebug) Faraday.get(RECODO_URL_PREFIX + @id.to_s + RECODO_URL_SUFFIX)
#<Faraday::Response:0x00007f8c30283ea8 @on_complete_callbacks=[], @env=#<Faraday::Env @method=:get @url=#<URI::HTTPS https://www.el-recodo.com/music?id=%7B%3Aid%3D%3E1%7D&lang=en> @request=#<Faraday::RequestOptions (empty)> @request_headers={"User-Agent"=>"Faraday v1.1.0"} @ssl=#<Faraday::SSLOptions verify=true> @response=#<Faraday::Response:0x00007f8c30283ea8 ...> @response_headers={"date"=>"Mon, 08 Mar 2021 22:00:49 GMT", "content-type"=>"text/html; charset=UTF-8", "transfer-encoding"=>"chunked", "connection"=>"keep-alive", "server"=>"Apache", "content-location"=>"music.php", "vary"=>"negotiate", "tcn"=>"choice", "x-powered-by"=>"PHP/7.3", "set-cookie"=>"PHPSESSID=42423b2d38b4be296c7c9b162e837e37; path=/", "expires"=>"Thu, 19 Nov 1981 08:52:00 GMT", "cache-control"=>"no-store, no-cache, must-revalidate", "pragma"=>"no-cache", "location"=>"404", "content-security-policy"=>"upgrade-insecure-requests"} @status=302 @reason_phrase="Found" @re
class Video::MusicRecognition::AcrCloud
class << self
def fetch(youtube_id)
new(youtube_id).update_video
end
end
def initialize(youtube_id)
@youtube_id = youtube_id
@video = Video.find_by(youtube_id: youtube_id)
# == Schema Information
#
# Table name: videos
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# title :text
# youtube_id :string
# leader_id :bigint