Skip to content

Instantly share code, notes, and snippets.

View itkrt2y's full-sized avatar
✂️
Yak Shaving

Tatsuya Itakura itkrt2y

✂️
Yak Shaving
View GitHub Profile
@itkrt2y
itkrt2y / scrap-amazon-book.js
Last active April 8, 2018 15:47
Amazon商品ページの本の情報をScrapboxに記録する
const title = (document.querySelector("#productTitle") || document.querySelector("#ebooksProductTitle")).innerText;
let body = '[amazon ' + window.location.href + ']\n';
const orderContainer = (document.querySelector("#instantOrderUpdate") || document.querySelector("#ebooksInstantOrderUpdate"));
if (orderContainer) {
const year = new RegExp(/\d{4}/).exec(orderContainer.innerText)[0];
const year_month = new RegExp(/\d{4}\/\d{1,2}/).exec(orderContainer.innerText)[0];
body = body + 'Ordered: [' + year + '], [' + year_month + ']\n';
}
@itkrt2y
itkrt2y / rails_https.md
Created September 21, 2018 08:40
Rails Local Development over HTTPS
@itkrt2y
itkrt2y / open-pull-request
Created November 29, 2019 03:44
Open Pull Request associated with a commit id
#!/bin/sh
# Required: hub, jq
commit=$1
pr=$(hub api graphql -F query="
{
repository(name: \"{repo}\", owner: \"{owner}\") {
commit: object(expression: \"$commit\") {
... on Commit {
@itkrt2y
itkrt2y / docker-compose.yml
Created December 4, 2019 11:46
Docker / MySQL (utf8mb4)
version: "3"
services:
db:
image: mysql:5.7
container_name: sample-db
ports:
- 3344:3306
volumes:
- ./db/mysql:/var/lib/mysql
@itkrt2y
itkrt2y / .eslintrc.js
Last active February 22, 2021 01:03
VSCode + TypeScript + ESLint + Prettier + React
/** @type import("eslint").Linter.Config */
module.exports = {
env: { browser: true, node: true },
parser: '@typescript-eslint/parser',
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:react/recommended",
@itkrt2y
itkrt2y / get-width-of-text-in-browser.js
Last active September 26, 2021 06:17
Get width of text in browser
document.createElement("canvas")
.getContext("2d")
.measureText("Hello こんにちは 😀")
.width;
@itkrt2y
itkrt2y / NumberInput.tsx
Last active April 19, 2022 12:01
react-hook-form + ChakraUI NumberInput
import {
NumberDecrementStepper,
NumberIncrementStepper,
NumberInput,
NumberInputField,
NumberInputStepper,
} from "@chakra-ui/react";
import { Controller } from "react-hook-form";
<Controller
@itkrt2y
itkrt2y / gnome-terminal-profile.dconf
Last active January 14, 2023 07:27
gnome-terminal profile
[/]
audible-bell=false
background-color='rgb(15,15,15)'
bold-is-bright=false
default-size-columns=96
default-size-rows=42
palette=['rgb(0,0,0)', 'rgb(205,0,0)', 'rgb(0,205,0)', 'rgb(205,205,0)', 'rgb(30,144,255)', 'rgb(205,0,205)', 'rgb(0,205,205)', 'rgb(229,229,229)', 'rgb(127,127,127)', 'rgb(255,0,0)', 'rgb(0,255,0)', 'rgb(255,255,0)', 'rgb(72,111,213)', 'rgb(255,0,255)', 'rgb(0,255,255)', 'rgb(255,255,255)']
visible-name='manjaro-custom'
@itkrt2y
itkrt2y / page.rb
Last active April 12, 2023 16:23 — forked from rmosolgo/page_example.rb
Generic page number / per-page pagination with GraphQL-Ruby
class Page
DEFAULT_PAGE_SIZE = 20
def initialize(all_nodes, page:, per_page:)
@all_nodes = all_nodes
# Normalize pagination arguments
@page = if page.nil? || page < 1
1
else
page
@itkrt2y
itkrt2y / install.sh
Last active December 11, 2023 07:11
Setup Manjaro Linux (Gnome)
sudo pacman -Syu \
base-devel \
dconf-editor \
docker \
github-cli \
hub \
noto-fonts \
noto-fonts-cjk \
noto-fonts-emoji \
neovim \