Skip to content

Instantly share code, notes, and snippets.

View taichunmin's full-sized avatar

戴均民 taichunmin

View GitHub Profile
@taichunmin
taichunmin / flex-dice.json
Created June 13, 2020 20:19
能使用變數的 LINE 訊息推送小工具
{
"type": "bubble",
"hero": {
"type": "image",
"url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png",
"size": "full",
"aspectRatio": "20:13",
"aspectMode": "cover"
},
"body": {
@taichunmin
taichunmin / flex-dice-ga.txt
Last active June 17, 2020 08:58
能使用變數的 LINE 訊息推送小工具 (+Googla Analytics 追蹤)
<% function gaScreenView (lineId, name) {
return `https://www.google-analytics.com/collect?${Qs.stringify({
an: 'My App',
cd: name, // 畫面名稱,
cid: lineId.replace(/^U(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})$/, '$1-$2-$3-$4-$5'), // client id
ds: 'app', // 資料來源,填寫為 app
t: 'screenview',
tid: 'UA-xxxxxxxxx-1', // GA 追蹤代碼
uid: lineId, // LINE userId
ul: 'zh-tw', // locale
@taichunmin
taichunmin / index.js
Last active December 10, 2019 14:16
Google Cloud Function for LINE pushMessage https://hackmd.io/@taichunmin/B1rUayhjr
const axios = require('axios')
exports.helloWorld = async (req, res) => {
res.set('Access-Control-Allow-Origin', '*')
res.set('Access-Control-Allow-Credentials', 'true')
if (req.method === 'OPTIONS') {
// Send response to OPTIONS requests
res.set('Access-Control-Allow-Methods', 'POST, OPTIONS')
res.set('Access-Control-Allow-Headers', 'authorization,content-type')
@taichunmin
taichunmin / mp-portal.user.js
Last active November 27, 2019 10:10
這是為了讓微程式的 Portal 系統支援 Chrome,需先安裝 Greasemonkey 或 Tampermonkey 才能執行! 下方連結是安裝網址。 https://gist.github.com/taichunmin/b480b8322b5cf0eadbfbc07f3dd2e485/raw/mp-portal.user.js
// ==UserScript==
// @name Microprogram Portal
// @namespace http://ef.program.com.tw:8081/
// @version 1.16
// @description try to let portal support Chrome
// @author taichunmin <taichunmin@gmail.com>
// @website https://gist.github.com/taichunmin/b480b8322b5cf0eadbfbc07f3dd2e485/
// @updateURL https://gist.github.com/taichunmin/b480b8322b5cf0eadbfbc07f3dd2e485/raw/mp-portal.user.js
// @downloadURL https://gist.github.com/taichunmin/b480b8322b5cf0eadbfbc07f3dd2e485/raw/mp-portal.user.js
// @match http://ef.program.com.tw:8081/*
// ==UserScript==
// @name 爐石牌組代碼預覽
// @version 1.1.14.6
// @description 預覽文章中牌組代碼的牌組內容
// @author starfi5h(海星)
// @namespace https://home.gamer.com.tw/starfi5h
// @include https://forum.gamer.com.tw/C.php?*bsn=24044*
// @include https://forum.gamer.com.tw/G2.php?*bsn=24044*
// @match https://forum.gamer.com.tw/C.php?*bsn=60076*&snA=4483814*
// @include https://m.gamer.com.tw/forum/C.php?bsn=24044*
@taichunmin
taichunmin / messaging-api.html
Created September 6, 2019 06:35
LINE Messaging API reference 20190729 vs 20190906
<div class="Main Reference Reference-hasSide">
<div class="Content">
<div class="ReferenceCodesSide"></div>
<ul class="BreadCrumb">
<li><a href="/en/"><span>LINE Developers</span></a></li>
<li><a href="/en/reference/"><span>API references</span></a></li>
<li class="current">Messaging API reference</li>
</ul>
<div class="Article">
<section class="SectionReference SectionReference-hasSide">
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
/**
* Auto-generated code below aims at helping you parse

Factorio 1.6 科技包

0eNq1XUtzm8lu/SsuLZKN6dvvxyyTRbapZJVKTd2iZV6bNRSloqS5mdzSfw81EqVPMtB9DqisZsYeng+NfgCNBg7+cfF1d7+5OWz3d3/9en3928Uv/3j9k9uLX/578Z+Pf7e9vN4//fHt9vt+vXv8s7s/bjYXv1xs7zZXF58v9uurx/+6vdxu9peb1c368reVv3j4fLHdf9v8z8Uv/uEz9+Ow+HF4+PXzxWZ/t73bbp7E+PM//vjr/v7q6+ZwRH/BWN/ebq6+7rb776ur9eWP7X5zRPp8cXN9e/zx9f7x20fAVfl88cfxH/4o1sVhc7m9Eb//03cC+51o+04kv+Nsn0nkZ4yjyeRnjJNTXhfS1Xq3W212m8u7w/ZydXO92whzU58+0x8ErPqCtd3fbg53xz9TF5EI0F4A7g7r/e3N9eFu9XWzu9Nh2nG037bH8T79XRBA+wvo7vqowh/r4/b4thpImE4SvoFOArR3LHbGsT2ujAQrwwccNeOokVxFYbAIfEKWURwhZHyQAR9kwVEjjlrZJeTxJYTvJ4cL3HE1eBg1OGDSR6smeADAjwDwnYGvmRBhUEJXidtto60SMrn88MMx4PsFP79ChUHxPRgasHZGdiuwNgY3A9HBA8ZNYsRtC24EYuCW5ciTiPi+qbiAr/vm79fX3zb71eWPza10brUnzHLE/Lo+KGiZdlYKIOPrpvnb+vZuZAeqCFok0Eq7EhUQtdGuBILaEeufTmOX/HNHyyXjeNqLAMaXAu1FIKhGB0weeGJdkiguRek4S5l1SZDRF9olQVAr6xAgoI11CBDQzkoKnETZseYbkDR71nwjoIGVFBl+ZCVFQBNrd5

dont starve together cave

{
  "MINE_workable": {
    "rock1": 1,
    "rock2": 1,
    "rock_flintless": 1,
    "rock_petrified_tree": 1,
    "stalagmite": 1,
// 一般的寫法
new Promise(function(resolve, reject) {
setTimeout(function() {
// resolve()
reject(new Error('123'))
}, 1000)
}).then(function() {
console.log('success')
}).catch(function(e) {
console.error(e)