Skip to content

Instantly share code, notes, and snippets.

@Eotones
Eotones / README.md
Last active October 23, 2024 07:27
speechSynthesis強制使用Chrome中的Google小姐中文語音

speechSynthesis強制使用Chrome中的Google小姐中文語音

網路上的window.speechSynthesis教學主要都只有說切換指定語言

像是這樣就能切換成中文語音:

const synth = window.speechSynthesis;

const speak = (msg) => {
@Eotones
Eotones / fooModule.js
Created January 1, 2020 09:08
template
export default class fooModule {
constructor(){
//..
}
doSomeThing(){
console.log("doSomeThing");
}
}
@Eotones
Eotones / README.md
Last active October 3, 2024 07:05
[UserScript] 把Plurk的Referrer-Policy從origin改成same-origin

[UserScript] 把Plurk的Referrer-Policy從origin改成same-origin

解決新版Twitter(2020年3月)對於外部網站點擊連結到含有敏感內容推文無法觀看的bug

已知bug產生條件

  • 使用者已登入Twitter,並且帳號有開啟觀看敏感內容的權限
  • 使用者從Twitter以外的網站點擊含有敏感內容的Twitter連結,並且HTTP Request Header帶有來源網站的referrer

幾種解決方法

利用瀏覽器的Referrer-Policy阻止來源網站的referrer送出

  • 方法一: <a href="" rel="noreferrer">link</a>
@Eotones
Eotones / meta-theme-color.js
Created February 19, 2021 15:58
meta-theme-color
// ==UserScript==
// @name meta-theme-color
// @namespace http://tampermonkey.net/
// @version 0.1
// @description add meta theme color
// @author Eotones
// @match https://term.ptt.cc/*
// @grant none
// ==/UserScript==
@Eotones
Eotones / index.html
Created March 1, 2021 17:28 — forked from AlcaDesign/index.html
An almost complete tmi.js example (browser)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Chat</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="https://d2g2wobxbkulb1.cloudfront.net/0.0.19/tmi.js"></script> <!--For developement-->
<!--<script src="https://d2g2wobxbkulb1.cloudfront.net/0.0.19/tmi.min.js"></script>--> <!--For "production"-->
</head>
@Eotones
Eotones / README.md
Last active May 11, 2024 07:10
Nightbot自訂Twitch指令 - 美金和台幣匯率換算 (下方有新增其他Nightbot自訂指令)

Nightbot自訂Twitch指令 - 美金和台幣匯率換算

USD 轉 TWD

Twitch聊天室輸入指令新增:

!commands add !usd $(eval const n=parseFloat('$(query)');if(!isNaN(n)){const api = $(urlfetch json https://tw.rter.info/capi.php); api.error || (!api.USDTWD.Exrate) ? '查無資料' : `${n} USD = ${(n*api.USDTWD.Exrate).toFixed(2)} TWD (source: RTER)`;}else{'請在指令後面輸入數字'})
@Eotones
Eotones / LunarCalendar.php
Created January 29, 2022 05:13 — forked from jfcherng/LunarCalendar.php
PHP 農曆相關
<?php
class Lunar
{
const MIN_YEAR = 1891;
const MAX_YEAR = 2100;
const LUNAR_INFO = [
[0, 2, 9, 21936], [6, 1, 30, 9656], [0, 2, 17, 9584], [0, 2, 6, 21168], [5, 1, 26, 43344], [0, 2, 13, 59728],
[0, 2, 2, 27296], [3, 1, 22, 44368], [0, 2, 10, 43856], [8, 1, 30, 19304], [0, 2, 19, 19168], [0, 2, 8, 42352],