Skip to content

Instantly share code, notes, and snippets.

View hiing's full-sized avatar
🤒
Out sick

away hiing

🤒
Out sick
View GitHub Profile
@hiing
hiing / header.php
Created December 28, 2014 13:52
wordpress首页添加访问密码
<?php
if (!isset($_SESSION)) {
session_start();
}
if( isset($_SESSION['authenticated']) )
{
if($_SESSION['authenticated'] == 'yes')
{
$authenticated = 'yes';
@hiing
hiing / gist:dbd4223ddcd89fba8d4a975557448807
Last active November 17, 2021 07:14
Google Fonts 反代。在 fonts.googleapis.com 前加上 Worker域名,形如 https://fonts.XXX.workers.dev/fonts.googleapis.com/css?XXXXX
addEventListener("fetch", event => {
// Fail-safe in case of an unhandled exception
event.passThroughOnException();
if (event.request.method === 'GET') {
const url = new URL(event.request.url);
const accept = event.request.headers.get('Accept');
if (url.pathname.startsWith('/fonts.gstatic.com/')) {
// Pass the font requests through to the origin font server
// (through the underlying request cache).
event.respondWith(proxyRequest('https:/' + url.pathname + url.search,