Skip to content

Instantly share code, notes, and snippets.

View tigercosmos's full-sized avatar
🙃
Feel free to reach me!

Liu, An-Chi tigercosmos

🙃
Feel free to reach me!
View GitHub Profile
var PATTERN = new RegExp(
'(而家|立(?:刻|即)|即刻)|' +
'(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|' +
'(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|' +
'(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)' +
'(?:[\\s|,|,]*)' +
'(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?', 'i');
async function platformReplyImage(context, url) {
if (process.env.chatroomPlatform == 'messenger') {
await context.sendImage(url)
} else {
await context.replyImage(url);
}
}
// ...
// 一些預處理,抓地點、時間、氣象關鍵字等
// ...
} else if (isWeatherKeyword) { // 如果是要回應「天氣」況狀,例如:天氣、濕度、溫度
let replyMsg = ""; // 將回傳給使用者的資訊
// ...
if (isTimeKeyword) { // 如果有時間關鍵字,並且不是現在,就採用預報
replyMsg = await getForecast(); // 取得氣象預報資料
} else { // 不然就回答現在天氣
replyMsg = await getWeather(); // 取得現在氣象狀況
@tigercosmos
tigercosmos / php-deploy.md
Created July 14, 2017 14:40 — forked from y2468101216/php-deploy.md
how to deploy php mysql apache2

php-deploy

required

  1. ubuntu 16.04
  2. php 7.1
  3. apache 2.4
  4. mysql 5.7
  5. git & composer
@tigercosmos
tigercosmos / EatingSnake.html
Last active May 6, 2016 14:02
Eating Snake
<!DOCTYPE html>
<html>
<head>
<title>Eating Snake</title>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
</head>
<body>
<style>
button {
@tigercosmos
tigercosmos / BubbleEffect.html
Last active April 3, 2018 05:00
Bubble Effects
<!DOCTYPE html>
<html>
<head>
<title>Bubbles</title>
<style>
#A1 {
margin: 0;
background: #0f0f0f;
max-width: 600px;
}
@tigercosmos
tigercosmos / goL.html
Last active May 3, 2016 13:18
game of life
<!DOCTYPE html>
<html>
<head>
<title>Game of Life</title>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
</head>
<body>
<style>
button {