Skip to content

Instantly share code, notes, and snippets.

View yuu's full-sized avatar
:octocat:
every write code

yuu yuu

:octocat:
every write code
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

タイトル

react-hook-formとyupを使った重複チェックバリデーション

初めに

最近yupに値の重複チェックするためのいい感じの機能が入ったので、react-hook-formと組み合わせて重複チェックをする方法を備忘のため書き綴っていきます。 今まではデータのネストが深い場合、ネストを遡って他のデータにアクセスしデータのバリデーションが難しかったのですが、yupのv0.29.1から追加されたtest関数のコンテキストのfromプロパティを使用することによってネストを遡ることが容易になりました。
jquense/yup#556

今回はそのfromを使用し、フォームの重複チェックバリデーションを作ってみます。

@gimKondo
gimKondo / deploy-feature-by-pr-comment.yaml
Created June 10, 2020 15:59
Deploy feature branch by pull request comment
name: deploy dev from feature by pull request
on:
issue_comment:
types:
- created
jobs:
deploy:
# add comment of pull request && comment is KEYWORD
@voluntas
voluntas / shiguredover.rst
Last active February 2, 2024 01:16
時雨堂 バージョニング

時雨堂 バージョニング

更新:2023-08-13
作者:@voluntas
バージョン:2023.1
URL:https://voluntas.github.io/

変更履歴

@imami
imami / anydesk-enable-remote-access.md
Last active May 8, 2024 00:52
AnyDesk - How Enable Remote Access from ubuntu/debian terminal

###AnyDesk - How Enable Remote Access from ubuntu/debian terminal.

Note:

Here are the commands might be usefull in this purpose:

  • anydesk --get-status : To get current status of anydesk, which might be offlien,online or nothing.
  • anydesk --get-id : To get the ID that your system can be accessed by.
  • anydesk --service : To start anydesk service if not already running (for Linux).
  • anydesk --restart-service : To restart anydesk service
  • anydesk --stop-service : To stop anydesk service
@cvan
cvan / tailwind.config.js
Last active February 2, 2024 18:39
tailwind CSS breakpoints (including iPhone 11 Pro Max)
// References used:
// - https://yesviz.com/devices.php
// - https://ricostacruz.com/til/css-media-query-breakpoints
// - https://tailwindcss.com/docs/responsive-design/#customizing-breakpoints
screens: {
'2xs': { min: '300px' },
xs: { max: '575px' }, // Mobile (iPhone 3 - iPhone XS Max).
sm: { min: '576px', max: '897px' }, // Mobile (matches max: iPhone 11 Pro Max landscape @ 896px).
md: { min: '898px', max: '1199px' }, // Tablet (matches max: iPad Pro @ 1112px).
lg: { min: '1200px' }, // Desktop smallest.
@LambdaNote
LambdaNote / writing.md
Last active March 5, 2024 01:29
記事の書き方

記事の書き方

記事の執筆には、Markdown形式を利用してください。 Markdownにはさまざまな流派がありますが、GitHub Flavored Markdown(https://github.github.com/gfm/ )をベースとした書式を採用します。

書籍を執筆するための形式として考えると、Markdownには不足している機能が多々あります。 しかし、次のような利点があるので、Markdownを採用することにします。

  • 最低限の構造しかないので、見た目でごまかせる余地が少ない
  • 原稿を著者自身が再利用してもらいやすくしたい
postFile('http://example.com/api/v1/users', 'input[type="file"].avatar')
.then(data => console.log(data))
function postFile(url, fileSelector) {
const formData = new FormData()
const fileField = document.querySelector(fileSelector)
formData.append('username', 'abc123')
formData.append('avatar', fileField.files[0])
@CodyReichert
CodyReichert / react-es6-flow-emacs-configuration.md
Last active May 13, 2024 07:35
Configuring Emacs for react, es6, and flow

Configuring Emacs for react, es6, and flow

For a while, JSX and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.

This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.

Set up web-mode

web-mode provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.

@externvoid
externvoid / TypeScript_Essential.md
Last active June 2, 2020 00:35
TypeScriptのミソ

C言語構造体宣言

struct point {
  float: x;
  float: y;
};

あるいは、

typedef struct {