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 { useState, useDeferredValue } from 'react' | |
type Props<T> = { | |
height: number | |
items: T[] | |
maxItemCount?: number | |
itemHeight: number | |
bufferCount?: number | |
renderItem: (item: T, index: number) => JSX.Element | |
onRender?: (lastIndex: number) => void |
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 esbuild from 'esbuild' | |
import { fileURLToPath, URL } from 'node:url' | |
import fs from 'node:fs' | |
const entryPoint = fileURLToPath(new URL('../src/app.js', import.meta.url)) | |
const outdir = fileURLToPath(new URL('../dist', import.meta.url)) | |
// ビルドされたcssをjsに埋め込む | |
function injectCssToJs(outputFilename = (jsFilename) => jsFilename) { | |
return { |
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
<script lang="ts" setup> | |
const props = defineProps<{ | |
map: google.maps.Map; | |
item: Item | |
selected: boolean | |
}>(); | |
const emits = defineEmits<{ | |
(e: 'toggleSelect', item: Item): void; | |
}>(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# [email protected] だとなぜか | |
# /usr/bin/git ftp push --force --auto-init --verbose --syncroot=./ --user=*** --passwd=*** --remote-root *** *** | |
# fatal: Unrecognised option: *** | |
# 差分のみアップロードするとのことだが、全部アップロードしてた | |
name: FTP deploy | |
on: | |
push: | |
branches: |
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
function smoothScroll (scroller, endY) { | |
if (typeof scroller === 'number') { | |
endY = scroller; | |
scroller = window; | |
} | |
const startY = scroller === window ? scroller.pageYOffset : scroller.scrollTop; | |
const maxY = (scroller === window) ? | |
document.documentElement.scrollHeight - document.documentElement.clientHeight : | |
scroller.scrollHeight - scroller.clientHeight; | |
endY = Math.min(endY, maxY); |
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
function my_enqueue_inline_style ( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) { | |
if ( $src ) { | |
wp_enqueue_style( $handle, $src, $deps, false, $media ); | |
} | |
add_filter( 'style_loader_tag', function ( $html, $this_handle, $href, $media ) use ($handle) { | |
if ($this_handle !== $handle) { | |
return $html; | |
} | |
$css_url = explode('?', $href)[0]; | |
$css_path = str_replace(site_url(), ABSPATH, $css_url); |
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
function my_enqueue_inline_script ($handle, $src = false, $deps = array(), $ver = false, $in_footer = false) { | |
if ( $src ) { | |
wp_enqueue_script( $handle, $src, $deps, false, $in_footer ); | |
} | |
add_filter( 'script_loader_tag', function ( $tag, $this_handle, $src ) use ($handle) { | |
if ($this_handle !== $handle) { | |
return $tag; | |
} | |
$url = explode('?', $src)[0]; | |
$path = str_replace(site_url(), ABSPATH, $url); |
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
function add_shortcode_template ($name, $template = '') { | |
if ( !$template ) { | |
$template = $name; | |
$name = basename($template, '.php'); | |
} | |
if ( !preg_match('/\.php$/', $template) ) { | |
$template .= '.php'; | |
} | |
$template = get_template_directory() . '/' . $template; | |
add_shortcode($name, function ($atts, $content = '') use ($template) { |
NewerOlder