save currentUser & header support monky patch
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
import React, { ChangeEvent } from "react"; | |
import { | |
Control, | |
DeepMap, | |
FieldError, | |
FieldValues, | |
RegisterOptions, | |
useController, | |
} from "react-hook-form"; | |
import { ErrorMessage } from "@hookform/error-message"; |
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 CreateUserRelationships < ActiveRecord::Migration[5.2] | |
def change | |
create_table :user_relationships do |t| | |
t.references :follower, foreign_key: { to_table: :users } | |
t.references :followed, foreign_key: { to_table: :users } | |
t.timestamps | |
t.index [:follower_id, :followed_id], unique: true | |
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
// http://example.com/:ID | |
const getIDfromURL = (url: string): string => | |
new URL(url).pathname.replace(/\//g, ""); | |
export default getIDfromURL; |
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
// https://www.youtube.com/watch?v=:ID | |
// https://www.youtube.com/channel/:ID | |
const getIDfromYoutubeURL = (url: string): string | null => { | |
const newURL = new URL(url); | |
const { pathname } = newURL; | |
if (pathname.includes("watch")) return newURL.searchParams.get("v"); | |
if (pathname.includes("channel")) return pathname.split("/")[2]; | |
return null; | |
}; |
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
# frozen_string_literal: true | |
RSpec.shared_examples 'respond_with' do |http_status, openapi: false| | |
# openapi | |
openapi = { summary: metadata[:example_group][:parent_example_group][:parent_example_group][:description] } if openapi | |
describe '', openapi: openapi do | |
let(:id) do | |
super() | |
rescue StandardError | |
nil |
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
import { model as Model } from "@coderline/alphatab"; | |
import { match, P } from "ts-pattern"; | |
export const exportTex = (score: Model.Score) => { | |
let result = ""; | |
const [tracks, metaData] = compileScore(score); | |
result += metaData; | |
result += tracks | |
.map((track) => { | |
let result = ""; | |
const [staves, metaData] = compileTrack(track); |