Skip to content

Instantly share code, notes, and snippets.

View laosb's full-sized avatar
⚔️
Public attention is a double-edged sword.

Shibo Lyu laosb

⚔️
Public attention is a double-edged sword.
View GitHub Profile
@laosb
laosb / SwiftUIMenuBackdropPenetrationFix.swift
Created May 8, 2023 10:33
Fix SwiftUI Menu Backdrop Penetration.
import UIKit
// https://devnotes.by.sb/apple/swiftui/menu-backdrop-not-blocking-user-interactions
class SwiftUIMenuBackdropPenetrationFix: UIView {
// _UIContextMenuPlatterTransitionView
static let transitionViewClass: AnyClass? = NSClassFromString("_UIContextMenuPlatterTransitionView")
// _UIContextMenuContainerView
static let containerViewClass: AnyClass? = NSClassFromString("_UIContextMenuContainerView")
static func swizzle() {
@laosb
laosb / heti-minimal.scss
Last active February 18, 2023 17:45
The minimal styles to use with Heti's add-on script, mainly for interscript spacing.
// https://github.com/sivan/heti/blob/master/lib/helpers/_inline.scss
heti-spacing {
display: inline;
& + sup,
& + sub {
margin-inline-start: 0;
}
}
@laosb
laosb / Info.plist
Last active September 21, 2022 09:15
Export a file package.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>0</integer>
@laosb
laosb / force1111.sgmodule
Created November 16, 2021 16:29
Surge Module - Force 1.1.1.1
#!name=Force 1.1.1.1
#!desc=Change DNS server to 1.1.1.1.
[General]
dns-server = 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001
@laosb
laosb / DirectEmailProto.sgmodule
Created October 30, 2021 17:15
Make emails (via SMTP & IMAP) go direct.
#!name=Email Protos Go Direct
#!desc=Make emails (via SMTP & IMAP) go direct.
[Rule]
# IMAP
DEST-PORT,585,DIRECT
DEST-PORT,993,DIRECT
DEST-PORT,143,DIRECT
@laosb
laosb / aqicn.js
Last active August 16, 2023 09:40
Quantumult X Script to use AQICN in iOS Weather app
// Developed by Hackl0us (https://github.com/hackl0us)
// Adopted to Quantumult X Rewrite Script by laosb (https://lao.sb/gh)
// STEP 1: 前往 https://aqicn.org/data-platform/token/ 注册账户,将申请的 API Token 填入下方
const aqicnToken = ''
// STEP 2: 参考下方配置片段,在代理工具的配置文件中添加对应的配置。注意:script-response-body 后应该替换为添加 apicnToken 值后的脚本路径
/*
[rewrite_local]
https://weather-data.apple.com/v2/weather/[\w-]+/-?[0-9]+\.[0-9]+/-?[0-9]+\.[0-9]+\? url script-response-body aqicn.js
@laosb
laosb / default.custom.yaml
Last active October 8, 2022 03:43
Rime configuration
# To use rime-install:
#
# curl -fsSL https://raw.githubusercontent.com/rime/plum/master/rime-install | bash
#
# To install emoji support:
#
# plum/rime-install emoji
# plum/rime-install emoji:customize:schema=bopomofo
patch:
@laosb
laosb / jsonBinApi.js
Created July 8, 2020 13:28
Simple API wrapper for JSONBin.io.
import fetch from 'node-fetch'
const secretKey = process.env.JSONBIN_SECRET_KEY
const basicHeaders = () => ({
'Content-Type': 'application/json',
'X-Master-Key': secretKey,
})
export const createBin = async (
https://press.one/p/v?s=c68037ddb531ce7aa32fa18d83e4d7d65ea8a9d3271f35b8cdb89ada8e64ff59c649383d639b03abb597684ebcece19646b6dac5c882efb7c1db4e64c0d1e5420&h=3853d0b19cebea473c331846fb9668c424ea3b6ace300f73ae44b71b13210e2d&a=a652d79e3704e3afdf298efbf81dc11a003f59d3&f=P1&v=3
@laosb
laosb / layouts_user-dropdown_vue.js
Created August 13, 2017 10:27
How we connect to backend accounts system on Nuxt.js
import axios from 'axios'
export default {
methods: {
async login() {
const data = await axios.post('https://example.com/api/login', {
username: this.$refs.username.value,
password: this.$refs.password.value
})
if (!data.err) {