Skip to content

Instantly share code, notes, and snippets.

View yszk0123's full-sized avatar
:octocat:

Yuji Suzuki yszk0123

:octocat:
View GitHub Profile
@yszk0123
yszk0123 / README.md
Last active January 1, 2020 13:59
Kindleのコンテンツと端末の管理をTSVに変換するブックマークレット
@yszk0123
yszk0123 / watchDataLayerPush.js
Created November 5, 2018 02:00
dataLayer (Google Tag Manager) のデバッグ用ブックマークレット
javascript:(() => {
function printGtmPayload(payload) {
console.table(payload);
}
function watch(target, methodName) {
const originalMethod = target[methodName];
function watchedMethod(...args) {
printGtmPayload(args[0]);
return originalMethod.apply(this, args);
}
@yszk0123
yszk0123 / PropTypes.ts
Created September 8, 2018 01:41
Vue.js + TypeScript を使う際に props に Array を渡す方法
/**
* refs. https://github.com/vuejs/vue/pull/6856/files#diff-23d7799dcc9e9be419d28a15348b0d99R129
* @example
* // Your single file component
* import * as PropTypes from '../../PropTypes';
*
* interface Item {
* id: number;
* value: string;
* }
@yszk0123
yszk0123 / getEnumKeys.ts
Created August 4, 2018 13:19
TypeScript の enum 型のキーを取り出す
/**
* @example
* enum ErrorCode {
* A = 'a',
* B = 'b'
* }
*
* const errorCodes = getEnumKeys(ErrorCode);
*
* console.log(errorCodes); //=> ['a', 'b']
@yszk0123
yszk0123 / docker-compose.yml
Last active February 28, 2018 22:02
Docker 上で実行した feature spec をデバッグする方法 ref: https://qiita.com/yszk0123/items/840f16ed388fb52b0e21
+ node:
+ container_name: node-test
+ image: node:9.6.1-alpine
+ command: sh -c 'cd /app && yarn init -y && yarn add selenium-webdriver && node test.js'
+ volumes:
+ - ./test.js:/app/test.js
+ networks:
+ test-network:
chrome:
container_name: chrome
@yszk0123
yszk0123 / extensions.json
Last active January 19, 2018 02:15
VS Code Settings Example
// .vscode/extensions.json
{
"recommendations": [
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
@yszk0123
yszk0123 / build-storybook-for-code-review.sh
Last active December 19, 2017 15:59
コードレビューに役立つ React Storybook の閲覧環境を作る ref: https://qiita.com/yszk0123/items/402f868a35534713fccf
#!/bin/bash
set -eu
# コンポーネントに変更がなければスキップ
if git diff master...HEAD --name-only | grep -q "src/\|stories/" ; then
:
else
echo "[Storybook] Skip"
exit 0
fi
@yszk0123
yszk0123 / get-expaneded-flow-type-information.sh
Last active June 19, 2017 23:05
flowtype の CLI から展開された型定義を得る方法
# cf. https://github.com/facebook/flow/issues/463#issuecomment-104720027
flow dump-types path/to/your/js
@yszk0123
yszk0123 / index.html
Last active April 29, 2017 15:45
Print devicemotion event (JS Bin// source https://jsbin.com/duwafe)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
@import url(http://fonts.googleapis.com/earlyaccess/notosansjapanese.css);
html {
@yszk0123
yszk0123 / application.html.erb
Created March 2, 2017 09:29
Webpacker を使わずに webpack で頑張る ref: http://qiita.com/yszk0123/items/95f4f08a255cf029fca8
...
<%= stylesheet_link_tag 'frontend/vendor', media: :all %>
...
<%= javascript_include_tag 'frontend/manifest', 'frontend/vendor', 'frontend/application' %>
...