Skip to content

Instantly share code, notes, and snippets.

//
// login_form_hook
//
document.querySelector("#customer_login")?.addEventListener("submit", () => {
const email = document.querySelector('input[name="customer[email]"]')?.value ?? ""
const object = {
"email": email,
}
webkit.messageHandlers.accountLogin.postMessage(object)
})
const hideHeaderAndFooter = (document) => {
const noneDisplayQuerySelectors = [
"#shopify-section-announcement-bar",
"#shopify-section-announcement",
"#shopify-section-header",
"#shopify-section-footer",
"shop-login-button"
]
noneDisplayQuerySelectors.forEach((querySelector) => {
const element = document.querySelector(querySelector)
@enomoto
enomoto / pkl.md
Created February 25, 2024 07:50
Search for Pkl
jq '.data.associatedAccounts[] | select(.contentProvider.name == "YOUR PROVIDER NAME") | .contentProvider.contentProviderId' detail_formatted.json
@enomoto
enomoto / generate_jwt.rb
Last active November 13, 2023 05:29
Generate JWT for App Store Connect API
require 'jwt'
require 'openssl'
# App Store Connect APIキー (.p8ファイル) の内容を読み込む
ecdsa_key = OpenSSL::PKey::EC.new(File.read("/path/to/your.p8"))
# Issuer ID (App Store Connectから取得)
# https://appstoreconnect.apple.com/access/api
issuer_id = "your_issuer_id"
@enomoto
enomoto / TabView.swift
Created October 18, 2023 06:40
SimpleTabView with SwiftUI
import SwiftUI
struct ContentView: View {
var body: some View {
MyTabView(
tabContents: [
.init(id: 0, title: "foo", content: PageView(title: "foo", color: .yellow)),
.init(id: 1, title: "bar", content: PageView(title: "bar", color: .red)),
.init(id: 2, title: "baz", content: PageView(title: "baz", color: .brown)),
@enomoto
enomoto / ContainerViewController.swift
Last active July 24, 2023 06:08
UIPageViewController with inifinite scrolling
import UIKit
final class ContainerViewController: UIViewController {
private let pageViewController: UIPageViewController = .init(transitionStyle: .scroll, navigationOrientation: .horizontal)
private let childViews: [UIViewController] = {
let vc0 = UIViewController()
vc0.view.backgroundColor = .red
let vc1 = UIViewController()
vc1.view.backgroundColor = .red.withAlphaComponent(0.6)
let vc2 = UIViewController()
@enomoto
enomoto / code_reading.md
Created July 12, 2023 01:43 — forked from taichi/code_reading.md
太一のコードの読み方メモ

太一のコードの読み方メモ

全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。

コードを読むとは何か

  • コードを嗜む
  • コードを学ぶ
  • 武器を手に入れる
@enomoto
enomoto / MyButton.swift
Created June 20, 2023 00:44
UIButton with UIButton.Configuration
import UIKit
final class MyButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
var configuration = UIButton.Configuration.filled()
configuration.title = "My Button"
configuration.baseForegroundColor = .black
configuration.baseBackgroundColor = .red
@enomoto
enomoto / head_comment_cleaner.sh
Created June 16, 2023 21:35
ファイルの先頭のコメントを削除する shell script
#!/bin/bash
# ファイルパスを指定してください
FILE_PATH="path/to/file.swift"
# ファイルの内容を読み込みます
content=$(cat "$FILE_PATH")
# コメント行を削除します
new_content=$(echo "$content" | sed -e '/^[[:space:]]*\/\/.*$/d')