Skip to content

Instantly share code, notes, and snippets.

View potato4d's full-sized avatar
💭
It's not so easy to be consistent

Takuma HANATANI potato4d

💭
It's not so easy to be consistent
View GitHub Profile
@potato4d
potato4d / file2.js
Last active February 21, 2017 00:37
英語資料を読むのが面倒な人のためのwebpack 2移行ガイド ref: http://qiita.com/potato4d/items/4975c3d9c5fe56fa78c1
const services = []
const serviceList = ["serviceA", "serviceB", "serviceD"];
serviceList.map((s)=>{
System.import("./services/" + s)
.then((mod)=>{
services.push(mod);
})
});
@potato4d
potato4d / ERROR
Last active March 30, 2017 08:36
no_unnecessary_double_quotes problem on coffeelint
[potato4d@Potato4d cfl_test]$ npm run test
> [email protected] test /Users/potato4d/Desktop/cfl_test
> coffeelint application.coffee
⚡ application.coffee
⚡ #2: Unnecessary double quotes are forbidden.
⚡ Warning! » 0 errors and 1 warning in 1 file
{
"event":"push",
"type":"UserChat",
"entity":{
"id":"149139",
"channelId":"1148",
"personType":"Veil",
"personId":"599bf2f432e826c8",
"state":"open",
"lastMessageId":"599bf2fe223aeff7",
<script>
p7.ready()
.then(function(p7){
const $$ = function(e){ return document.querySelectorAll(e) };
for(var button of $$('.subscribe-button')){
button.addEventListener('click', function(){
p7.subscribe();
})
}
})
@potato4d
potato4d / index.js
Created September 20, 2017 03:16
AWS LambdaでMisskeyの通知を受けるやつ
exports.handler = function(_, __, callback){
const axios = require('axios');
const firebase = require('firebase');
const misskey = Object.assign({}, axios);
// 悪
const CSRF_TOKEN = 'YOUR-MISSKEY-CSRF-TOKEN'
const APPNO = 'YOUR-PUSH7-APPNO'
const APIKEY = 'YOUR-PUSH7-APIKEY'
const COOKIE = 'YOUR MISSKEY.LINK COOKIE';
<template>
<section class="container">
<img :src="`https://github.com/${user.login}.png`" :alt="user.name">
<h1>{{user.name}}</h1>
</section>
</template>
<script>
import axios from 'axios'
@potato4d
potato4d / AccountInfo.type.js
Created October 19, 2017 06:57
Vue.jsのpropsカスタムバリデーターを使った堅牢なコンポーネント作成 ref: http://qiita.com/potato4d/items/1b92df0cbf9b0b6cf8d6
export const accountKeys = [
'id',
'name',
'bio'
];
@potato4d
potato4d / OAuthサンプル
Last active April 7, 2020 14:57
【v2対応】Nuxt.jsとFirebaseを組み合わせて爆速でWebアプリケーションを構築する ref: https://qiita.com/potato4d/items/cfddeb8732fec63cb29c
import firebase from 'firebase'
const provider = new firebase.auth.GoogleAuthProvider()
firebase.auth().signInWithRedirect(provider)
@potato4d
potato4d / Vuexで愚直に実装した例
Created December 24, 2017 03:29
実例からみるVuexアプリケーションにおけるv-model/computedとの付き合い方 ref: https://qiita.com/potato4d/items/f4b90a907c955e6679df
<div id="app">
<p>Component:</p>
<template v-if="isEdit">
<input type="text" :value="foo" @input="onInput">
<button type="button" @click="toggleEdit">Cancel</button>
</template>
<template v-else>
<span>{{foo}}</span>
<button type="button" @click="toggleEdit">Edit</button>
</template>
@potato4d
potato4d / JavaScript
Last active December 2, 2019 09:51
フロントエンドのバリデーションを hapi の joi で行うと手軽で便利 ref: https://qiita.com/potato4d/items/e2c88c940516aeb369b0
import Joi from 'joi-browser'