Skip to content

Instantly share code, notes, and snippets.

Avatar

Yoshihide Jimbo jmblog

View GitHub Profile
@jmblog
jmblog / gist:6077993
Last active Feb 28, 2021
所得税と住民税の計算方法
View gist:6077993

所得税(国税)

所得税の計算方法

所得税額 = (所得金額(A) - 所得控除額(B)) × 税率 - 税額控除額(C)

  • 「所得金額(A)- 所得控除額(B)」は 課税所得金額 といい、1,000円未満の端数を切り捨てる。

所得税の税率

View useDetectOutsideClick.ts
// https://letsbuildui.dev/articles/building-a-dropdown-menu-component-with-react-hooks
import { useState, useEffect, RefObject } from 'react';
export const useDetectOutsideClick = (ref: RefObject<HTMLElement>, initialState: boolean) => {
const [isActive, setIsActive] = useState(initialState);
useEffect(() => {
const pageClickEvent = (event: MouseEvent) => {
// If the active element exists and is clicked outside of
if (ref.current !== null && !ref.current.contains(event.target as Node)) {
@jmblog
jmblog / bash_prompt
Created May 23, 2014
Bash prompt customization
View bash_prompt
#!/usr/bin/env bash
# Check that terminfo exists before changing TERM var to xterm-256color
# Prevents prompt flashing in Mac OS X 10.6 Terminal.app
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
fi
# Turn off standout; turn off underline
tput sgr 0 0
View nuxt-netlify-http2-server-push-module.js
// https://www.netlify.com/blog/2017/07/18/http/2-server-push-on-netlify/
const debug = require('debug')('nuxt:netlify-http2-server-push');
const path = require('path');
const glob = require('glob');
const fs = require('fs');
module.exports = function module(moduleOptions) {
// This module is only enabled on production builds
if (this.options.dev) {
@jmblog
jmblog / gist:3222899
Created Aug 1, 2012
Simple HTML encoding/decoding using jQuery
View gist:3222899
// http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding
function htmlEncode(value){
return $('<div/>').text(value).html();
}
function htmlDecode(value){
return $('<div/>').html(value).text();
}
@jmblog
jmblog / file0.txt
Last active Dec 5, 2017
Vanilla JS や TypeScript で Custom Elements を書く際の注意点 ref: https://qiita.com/jimbo/items/d17a121f815236c2f55b
View file0.txt
Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
@jmblog
jmblog / karabiner.json
Last active Nov 12, 2017
かなキーで「英数/かな」のトグル切り替え(Karabiner-Elements 11.1.8以上が必要)
View karabiner.json
{
"profiles": [
{
"complex_modifications": {
"rules": [
{
"description": "Toggle input source (English or Japanese) by kana key (available since Karabiner-Elements 11.1.8)",
"manipulators": [
{
"conditions": [
View yui-fonts.scss
/* YUI Fonts.css
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.3.0
build: 3167
*/
body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}select,input,button,textarea{font:99% arial,helvetica,clean,sans-serif;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
@mixin font_10 { font-size: 77%; }
View navbar.slim
nav class="nav navbar navbar-inverse" role="navigation"
div class="container"
div class="navbar-header"
button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-gnav-collapse"
span class="sr-only" Toggle navigation
span class="icon-bar"
span class="icon-bar"
span class="icon-bar"
div class="collapse navbar-collapse navbar-gnav-collapse"
ul class="nav navbar-nav"
View tsconfig.json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"strictNullChecks": true,
"removeComments": true,
"module": "commonjs",
"target": "es5",
"jsx": "react"