Skip to content

Instantly share code, notes, and snippets.

@hiepnp1990
hiepnp1990 / accessibility_notifications.swift
Created October 10, 2024 13:55
MacOS Accessibility API Notifications
//
// MacOS Accessibility Notifications
// Notice: this version doesn't take into account new apps after this code is executed
// Created by Phi Hiep Nguyen and AI on 2024-10-08.
//
import Cocoa
import Foundation
// AppObserver: Monitors and reports application activation events on macOS
@astrarudra
astrarudra / whatsapp-delete-ads-business-chats.js
Last active July 1, 2024 01:16
WhatsApp - Delete Ads/Business Chats (No App, No Root - Only Browser) - This script deletes all business chats from WhatsApp Web. It is useful since most business chats are spam and are not useful. This script is to be run in the console of the WhatsApp Web page.
/*
Author: Rudra Roy
Tutodial/Demo: https://www.youtube.com/watch?v=KsMNGolq-Fs
Description:
This script deletes all business chats from WhatsApp Web.
It is usefulsince most business chats are spam and are not useful.
This script is to be run in the console of the WhatsApp Web page.
*/
const contextMenuEvent = new MouseEvent("contextmenu", {
@Gimenz
Gimenz / wa-decrypt.js
Created May 6, 2023 03:30
a function to decrypt WA Media
/**
* this code is copied from https://github.com/open-wa/wa-decrypt-nodejs
* i just made it more simplified
*/
const { default: axios } = require('axios');
const crypto = require('crypto');
const hkdf = require('futoin-hkdf');
const atob = require('atob');
@lewangdev
lewangdev / default.custom.yaml
Last active February 19, 2025 03:25
雾凇拼音自定义配置,MacOS-like & Wechat-like Dark/Light Color Scheme For Rime
patch:
# 菜单
menu:
page_size: 8 # 候选词个数
# alternative_select_labels: [ ①, ②, ③, ④, ⑤, ⑥, ⑦, ⑧, ⑨, ⑩ ] # 修改候选项标签
# alternative_select_keys: ASDFGHJKL # 如编码字符占用数字键,则需另设选字键
# ascii_mode、inline、no_inline、vim_mode 等等设定,可参考 /Library/Input Methods/Squirrel.app/Contents/SharedSupport/squirrel.yaml
# 中西文切换
#
# 【good_old_caps_lock】 CapsLock 切换到大写或切换中英。
@python273
python273 / app.py
Last active December 29, 2024 23:37
Flask Streaming Langchain Example
import os
os.environ["OPENAI_API_KEY"] = ""
from flask import Flask, Response, request
import threading
import queue
from langchain.chat_models import ChatOpenAI
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
from langchain.schema import AIMessage, HumanMessage, SystemMessage
@blackbing
blackbing / fetchStream.js
Last active September 1, 2024 08:05
Server Sent Event with fetch stream
const url = 'https://api.example.com/v1/sse';
const accessToken = 'test';
fetch(url, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
.then(response => {
if (response.ok && response.body) {
reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
@gbuckingham89
gbuckingham89 / tailwind.config.js
Last active November 30, 2024 03:47
iOS system colors for TailwindCSS
// The color palette is based on the iOS system colors.
// See: https://developer.apple.com/design/human-interface-guidelines/foundations/color/#system-colors-ios
// All colors are their "default" at level 500, then the shades above / below were generated by
// https://www.tailwindshades.com - except the grays, which are the straight-up iOS system gray colors.
colors: {
transparent: 'transparent',
white: '#ffffff',
black: '#000000',
gray: {
DEFAULT: '#8E8E93',
@sh3l6orrr
sh3l6orrr / TCA_zh.md
Last active October 9, 2024 03:22
TCA

The Composable Architecture (可组装架构)

The Composable Architecture (简写为TCA) 让你用统一、便于理解的方式来搭建应用程序,它兼顾了组装,测试,以及功效。你可以在 SwiftUI,UIKit,以及其他框架,和任何苹果的平台(iOS、macOS、tvOS、和 watchOS)上使用 TCA。

@mackuba
mackuba / creating_toolbar_buttons.md
Last active January 16, 2025 12:57
How to create toolbar buttons in AppKit

Creating toolbar buttons

Recently I was writing a post about NSButton styles on my blog, and when I got to the part about toolbar buttons (Textured Rounded), I realized that I actually had no idea how to create a toolbar in AppKit, so I had to do some research first. I found some help in this sample project from Apple and this project on GitHub, and then I did some experiments with different combinations of things to see what works where.

This could probably be a whole separate blog post on its own (and maybe I'll make this into one), but for now I've put it here to not make that main article even longer.

Here's what I've found:

There are a few different kinds of buttons you can put in the toolbar: