Skip to content

Instantly share code, notes, and snippets.

View unixzii's full-sized avatar
🤔
Thinking...

Cyandev unixzii

🤔
Thinking...
View GitHub Profile
@unixzii
unixzii / trapping_rain_water_tmp.cc
Last active March 30, 2024 07:28
A "Trapping Rain Water" implementation using C++ template metaprogramming.
template <int, typename>
struct List;
struct Nil {
template <int _NValue>
using Append = List<_NValue, Nil>;
};
template <int _Value, typename _Next>
struct List {
@unixzii
unixzii / ContentView.swift
Last active March 30, 2024 08:36
GPU particle system using Metal.
import SwiftUI
struct SmashableView: NSViewRepresentable {
typealias NSViewType = _SmashableNSView
let text: String
class _SmashableNSView: NSView {
@unixzii
unixzii / WKWebView+InputAccessory.h
Created December 8, 2023 05:10
A drop-in utility to customize input accessory view for `WKWebView`.
#import <WebKit/WebKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface WKWebView (InputAccessory)
@property (nonatomic, nullable, setter=cy_setCustomInputAccessoryView:) UIView *cy_customInputAccessoryView;
@end
@unixzii
unixzii / WeatherView.swift
Created November 7, 2023 13:21
A demo of implementing iOS Weather card in SwiftUI.
import SwiftUI
struct HeaderView: View {
var body: some View {
HStack {
Image(systemName: "info.circle.fill")
.resizable()
.frame(width: 12, height: 12)
Text("Section Header")
.font(.system(size: 13))
@unixzii
unixzii / fuck-x.user.js
Last active July 31, 2023 04:09
Tampermonkey userscript to rescue your X (formerly Twitter) experience.
// ==UserScript==
// @name Fuck X
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Save your eyes while using X (formerly Twitter)
// @author Cyandev <unixzii@gmail.com>
// @match https://twitter.com/*
// @grant none
// ==/UserScript==
@unixzii
unixzii / base64_cxx_tmp.cc
Last active February 18, 2023 06:44
A Base64 implementation using C++ template metaprogramming.
template<auto... Val>
struct List;
template<>
struct List<> {
template<auto Elem>
using Append = List<Elem>;
};
template<auto Head, auto... _Rest>
@unixzii
unixzii / dock_actions.m
Last active November 4, 2022 04:45
Perform some of Dock actions programmatically.
#import <dlfcn.h>
void sendMessageToDock(NSString *message) {
static dispatch_once_t onceToken;
static void (*ptrCoreDockSendNotification)(CFStringRef, int) = NULL;
dispatch_once(&onceToken, ^{
void *handle = dlopen("/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices", RTLD_LAZY);
if (!handle) {
return;
}
@unixzii
unixzii / HackingTextTransition.swift
Created June 29, 2022 09:35
Matrix live in your app!
//
// HackingTextTransition.swift
// Copyright (c) 2022 Cyandev<unixzii@gmail.com>.
//
import Foundation
import DequeModule
class HackingTextTransition {
[custom]
enable_rule_generator=true
overwrite_original_rules=true
# 白名单模式 PROXY,黑名单模式 DIRECT
custom_proxy_group=🧭Final`select`[]🌑Proxy`[]🌐Direct
# 节点选项
custom_proxy_group=🌑Proxy`select`[]🧯Fallback`[]🕹AutoTest`.*
# 国际流媒体服务
custom_proxy_group=🎞Streaming`select`[]🌑Proxy`[]🕹AutoTest`.*
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.