Skip to content

Instantly share code, notes, and snippets.

View dingyi's full-sized avatar
🏠
Working from home

Ding Yi dingyi

🏠
Working from home
View GitHub Profile
@TfTHacker
TfTHacker / ArchiveAndProcessNextFile.js
Last active December 4, 2023 19:17
Obsidian: Archive current file and then open next file in folder (Templater script)
<%*
/*
Updated: 9/20/2022
Author: TfTHacker
Gist: https://gist.github.com/TfTHacker
Twitter: https://twitter.com/TfTHacker
Requirements: Templater Plugin for Obsidian
Description: This script performs the following actions:
1. Moves current file to the archive folder (defined in the variable archivePath)
if archivePath is null, a folders in the vault will be presented for selection
@linuz90
linuz90 / Plausible Live Stats.scriptable
Last active September 27, 2023 23:29
iOS widget to display a live visitors count with Plausible analytics and Scriptable.
// Configuration
// You'll be able to set the domain when adding/editing the widget
// Make sure the stats are public on Plausible
const namespace = args.widgetParameter || "plausible.io"
const displayName = namespace.slice(0,namespace.lastIndexOf("."))
const accentColor = new Color("#CCCCCC")
// LineChart by https://kevinkub.de/
// Used as the widget background
class LineChart {
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@bendc
bendc / easing.css
Created September 23, 2016 04:12
Easing CSS variables
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

@soffchen
soffchen / surge.conf
Last active March 4, 2024 05:23
surge.conf
[General]
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
BJ-All = custom
BJ-HK-Azure = custom
BJ-US-Azure = custom
@janlay
janlay / README.md
Last active March 4, 2024 05:25
Yet another config for Surge.app

Install

  1. Modify index.txt with your output path and proxy info
  2. Use Text Builder to build configuration for Surge: $ text-builder -index /path/to/index.txt Or run $ sh build-all to build all your index files.
  3. Import configuration via AirDrop/iTunes/Dropbox/iCloud

本人不提供任何保证和技术支持,使用者自负风险。
There are no guarantees, no any support. Use it at your own risk.

@siamak
siamak / BEM__Mixin.scss
Last active May 17, 2021 14:10
Mixin of BEM selectors with SCSS
/*
_____ _ _ ___ ___ _ _ _ _
/ ___|(_) | | | \/ | | | | | | | (_)
\ `--. _ __ _ _ __ ___ __ _ | | __ | . . | ___ | | __| |__ | |_ __ _ _ __ _
`--. \| | / _` || '_ ` _ \ / _` || |/ / | |\/| | / _ \ | |/ /| '_ \ | __|/ _` || '__|| |
/\__/ /| || (_| || | | | | || (_| || < | | | || (_) || < | | | || |_| (_| || | | |
\____/ |_| \__,_||_| |_| |_| \__,_||_|\_\ \_| |_/ \___/ |_|\_\|_| |_| \__|\__,_||_| |_|
www.siamak.us
== Mixin of BEM selectors with SCSS: ==
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;