Skip to content

Instantly share code, notes, and snippets.

View hisasann's full-sized avatar
🔖
I aspire to become a bookseller.

Yoshiyuki Hisamatsu hisasann

🔖
I aspire to become a bookseller.
View GitHub Profile
@hisasann
hisasann / 別のdocsから議事録や日報をコピーするGAS.js
Last active October 20, 2020 09:39
Google Document でテンプレートとなる docs からひな形をコピーする Google Apps Script
// Google Apps Scriptで議事録テンプレ作成を楽にした - Qiita - https://qiita.com/wiroha/items/5ce99d7bfc56e3270be6
function onOpen() {
// Google Apps Scriptを使った独自メニューの作り方 - Qiita - https://qiita.com/howdy39/items/46ca1f2fd9d27eaba0c3
const ui = DocumentApp.getUi(); // Uiクラスを取得する
const menu = ui.createMenu('日報'); // Uiクラスからメニューを作成する
menu.addItem('1日分を新たに作成', 'insertTemplate'); // メニューにアイテムを追加する
menu.addToUi(); // メニューをUiクラスに追加する
}
@hisasann
hisasann / usr-local-bin-webstorm
Created May 5, 2020 07:53
webstorm コマンドを使えるようにする shell
#!/usr/bin/env python
# Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
# -*- coding: utf-8 -*-
import os
import socket
import struct
import sys
import traceback
@hisasann
hisasann / new Promise は非同期ではない.js
Created April 24, 2020 06:15
メモ:async await に引っ張られて Promise は非同期ぽさがあるが、非同期ではない。
console.log(1);
Promise.all([new Promise((resolve, reject) => {
console.log(3);
})]).then((values) => {
console.log(values);
});
console.log(2);
// 1
@hisasann
hisasann / jest-template-literal.js
Created April 13, 2020 01:34
describe.each でデータ行ごとに回す処理をテンプレートリテラルで書く方法
// https://jestjs.io/docs/en/api#describeeachtablename-fn-timeout
describe.each`
a | b | expected
${1} | ${1} | ${2}
${1} | ${2} | ${3}
${2} | ${1} | ${3}
`('$a + $b', ({a, b, expected}) => {
test(`returns ${expected}`, () => {
expect(a + b).toBe(expected);
});
@hisasann
hisasann / contentful-sample.js
Created February 17, 2020 16:43
contentful で getEntry する簡単なサンプル
const contentful = require("contentful");
const client = contentful.createClient({
// This is the space ID. A space is like a project folder in Contentful terms
space: "ra794i9t0yln",
// This is the access token for this space. Normally you get both ID and the token in the Contentful web app
accessToken: "U1Wffn5NIhptGsWKyliQCILCWpoaCjJK6mwJwYO_58g"
});
// This API call will request an entry with the specified ID from the space defined at the top, using a space-specific access token.
client.getEntries()
.then((response) => console.log(response.items))
@hisasann
hisasann / promise-emitter.js
Last active February 15, 2020 05:59
eventemitter3 のイベントハンドラの return 値で Promise を返せるようにするラッパー
import EventEmitter from 'eventemitter3';
class PromiseEmitter extends EventEmitter {
emit(event, ...args) {
let promises = [];
this.listeners(event).forEach((listener) => {
promises.push(listener(...args));
});
originの状態を確認する
git remote show origin
pullやpushがどう紐付いているか確認できる
ローカルに作ったブランチをリモートに反映
git push origin feature/a
リモートから削除されたブランチをローカルにも反映
git fetch -p
これも同じみたい(プル?ン)
@hisasann
hisasann / array-of-destructuring-assignment.js
Created November 5, 2019 08:13
配列の分割代入とオブジェクトの分割代入
const array = ['foo'];
array.hoge = 'hoge';
// あくまでも配列の順番通りに変数が割り振られる
// foo という key を抜き取ってきているわけではない
const [ foo ] = array;
// hoge という key を取ってきている
const { hoge } = array;
console.log(foo); // foo
@hisasann
hisasann / .gvimrc
Created June 2, 2019 08:31
the setting font part of .gvimrc
if has('gui_macvim')
set transparency=10
set guifont=Ricty\ Regular\ for\ Powerline:h13
set guioptions-=T
endif
@hisasann
hisasann / .vimrc
Last active June 2, 2019 08:29
the airline part of .vimrc
NeoBundle 'vim-airline/vim-airline'
NeoBundle 'vim-airline/vim-airline-themes'
"---------------------------------------------------------------------------
" for bling/vim-airline {{{
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_section_a = airline#section#create(['mode','','branch'])
let g:airline#extensions#tabline#enabled = 1