Skip to content

Instantly share code, notes, and snippets.

@syuji-higa
syuji-higa / gh-pages.yml
Created December 18, 2019 02:29
GitHub Actions - Genelate Nuxt.js deploy for GitHub Pages
name: github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-18.04
@syuji-higa
syuji-higa / nuxt.config.js
Last active December 18, 2019 06:09
Nuxt.js - PWA
// add '/static/icon.png' 512x512 (min: 192×192)
export default {
modules: [
'@nuxtjs/pwa'
],
manifest: {
name: process.env.npm_package_name,
title: process.env.npm_package_name,
'og:title': process.env.npm_package_name,
@syuji-higa
syuji-higa / gh-pages.yml
Created November 23, 2019 17:32
GitHub Actions - Genelate Nuxt.js deploy for GitHub Pages
name: github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-18.04
@syuji-higa
syuji-higa / .gitconfig
Last active November 16, 2019 04:51
Git - alias
[alias]
br = branch
co = checkout
st = status
cm = commit -m
di = diff
pl = pull origin
ps = push origin
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lga = log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
@syuji-higa
syuji-higa / index.js
Last active November 16, 2019 03:52
Node.js - view server
'use strict'
const { join } = require('path')
const Koa = require('koa')
const Router = require('koa-router')
const serve = require('koa-static')
const views = require('co-views')
require('colors')
const CLIENT_PORT = 9999
@syuji-higa
syuji-higa / index.js
Last active November 16, 2019 03:52
JavaScript - namespace
if (typeof APP !== 'undefined') {
throw new Error('namespace "APP" is already exists.')
}
window.APP = {}
@syuji-higa
syuji-higa / index.js
Last active November 16, 2019 03:53
Node.js - render HTML
'use strict'
const { readFile } = require('fs')
const Koa = require('koa')
const Router = require('koa-router')
require('colors')
const app = new Koa()
const router = new Router()
@syuji-higa
syuji-higa / index.html
Last active November 16, 2019 03:54
Node.js - WebSocket demo
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>title</title>
</head>
<body>
<button type="button" id="btn">Send</button>
@syuji-higa
syuji-higa / docker-compose.yml
Last active November 16, 2019 03:58
Docker Compose - Node.js
version: '2'
services:
node:
image: library/node
container_name: node-sample
volumes:
- ./src:/src
working_dir: "/src"
command: "node index.js"
@syuji-higa
syuji-higa / asyncData.spec.js
Last active October 12, 2021 15:27
Jest - Vue.js snipets
import { shallowMount } from '@vue/test-utils'
import Component from './Component.vue'
describe('Component', () => {
const wrapper = shallowMount(Component)
const data = wrapper.vm.$options.asyncData()
wrapper.setData(data)
it('should be shown "test" text', () => {