Skip to content

Instantly share code, notes, and snippets.

View edmondyip's full-sized avatar

Edmond Yip edmondyip

View GitHub Profile
@edmondyip
edmondyip / app.js
Created January 23, 2018 03:04
Convert Hex to RGB in Vue Method
data: {
return {
opacity: 50
}
},
methods: {
convertHex: function (color) {
color = color.replace('#', '')
let r = parseInt(color.substring(0, 2), 16)
let g = parseInt(color.substring(2, 4), 16)
<template>
<svg width="100%" x="0px" y="0px" id="background-svg" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 720 480"
preserveAspectRatio="none">
<g v-for="svg in svgList" :id="svg.name" style="display: none" :key="svg.id">
<path v-for="svgPath in svg.path" :d="svgPath" :key="svgPath.id" />
</g>
</svg>
</template>
@edmondyip
edmondyip / Background.vue
Created January 23, 2018 03:40
Import SVG Morpheus
<script>
import SVGMorpheus from "@/assets/svg-morpheus"
</script>
@edmondyip
edmondyip / Background.vue
Last active January 23, 2018 03:42
Data
<script>
import SVGMorpheus from "@/assets/svg-morpheus"
export default {
data: function () {
return {
target: this.$route.name,
svgBg: null,
svgList: [{
name: 'home',
path: ['M260,341V141H460V341Z']
<script>
methods: {
change: function () {
this.svgBg.to(this.target)
}
}
</script>
<script>
mounted: function () {
this.svgBg = new SVGMorpheus('#background-svg', {duration: 600, easing: 'circ-in', rotation: 'counterclock' })
this.target = this.$route.name
this.change()
}
</script>
@edmondyip
edmondyip / docker-compose.yml
Last active July 27, 2018 09:02
docker-compose ghost setting
version: '2' # docker-compose 的版本
services: # 以下就是服務,可以同時存放多個服務,運行時會一個個啟動
ghost: # service 的名,你可以改成任何不重覆的名稱
image: ghost:1.24.9-alpine # image 的版本,這裡我用了ghost v1.24.9 的輕量版
container_name: 256pages-blog # container 的名,在 docker 中都會見到這個而不是 service name
restart: always # 如果重新開機會自動重啟
ports: # 把 ghost 的 port 2368 mount 到 8080,8080 可以成其他
- '8080:2368'
volumes: # 因為我本身有舊的 ghost,所以把 content mount 到 ./blog 這位置
- './blog:/var/lib/ghost/content'
@edmondyip
edmondyip / routes.yml
Last active August 29, 2018 09:27
Ghost Dynamic Routing
routes:
collections:
/:
permalink: /{slug}/
template:
- index
taxonomies:
tag: /tag/{slug}/
routes:
/news/:
controller: channel
filter: 'tag:news'
data: tag.news
@edmondyip
edmondyip / docker-compose.yml
Last active August 30, 2018 10:32
WordPress + PHP7 + MariaDB + Nginx + Let's Encrypt
version: '2'
services:
# Nginx Proxy Server, ports 都由他管理
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy
restart: always
ports:
- "80:80"