Skip to content

Instantly share code, notes, and snippets.

View gongzhang's full-sized avatar

Gong Zhang gongzhang

View GitHub Profile
@atrinh0
atrinh0 / pluraliser_issues.swift
Last active June 1, 2024 20:38
Foundation Pluraliser Potential Issues
import SwiftUI
struct ContentView: View {
// sample of data was compiled using the following sources:
// https://birdgei.com/2011/08/30/list-of-100-irregular-plural-nouns-in-english/
// https://www.grammarly.com/blog/plural-nouns/
// https://www.thoughtco.com/irregular-plural-nouns-in-english-1692634
// https://www.ef.co.uk/english-resources/english-grammar/singular-and-plural-nouns/
// google
@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active May 26, 2024 01:13
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
// SwiftUI Custom Styles (TripleToggleStyle)
// https://swiftui-lab.com
// https://swiftui-lab.com/custom-styling
import SwiftUI
// MARK: - TripleToggle View
public struct TripleToggle: View {
@Environment(\.tripleToggleStyle) var style: AnyTripleToggleStyle
@bigmountainstudio
bigmountainstudio / GruvBox.xccolortheme
Last active May 28, 2024 04:40
Xcode Theme: GruvBox
<!-- Add this file to: ~/Library/Developer/Xcode/UserData/FontAndColorThemes -->
<?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>DVTConsoleDebuggerInputTextColor</key>
<string>0.901961 0.831373 0.639216 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>SFMono-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
Generating random data (100.00MB)
Start benchmark rc4-md5
Encrypt data in 0.224s
Decrypt data in 0.222s
Start benchmark aes-128-cfb
Encrypt data in 0.599s
Decrypt data in 0.597s
Start benchmark aes-256-cfb
@greencoder
greencoder / apns.sh
Created May 11, 2016 17:04
Curl the APNS http/2 API
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active June 1, 2024 05:51 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@nbasham
nbasham / UIColor.swift
Last active December 18, 2023 21:04
Swift 4: Convert CSS color names and RGB hex values to UIColor. UIColor from hex 3, 4, 6, and 8 characters in length with or without # prefix. UIColor to hex. UIColor extension that creates immutable UIColor instances from hexadecimal and CSS color name strings (e.g. ff0, #f00, ff0000, ff0000ff, Pink, aZure, CLEAR, nil). Conversely, you can obta…
//
// UIColor.swift
// previously Color+HexAndCSSColorNames.swift
//
// Created by Norman Basham on 12/8/15.
// Copyright ©2018 Black Labs. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@SlaunchaMan
SlaunchaMan / CLKTextProvider+NNNCompoundTextProviding.h
Created August 24, 2015 04:06
Getting around Swift 2’s lack of compatibility with vararg methods for complication text providers.
@interface CLKTextProvider (NNNCompoundTextProviding)
+ (nonnull CLKTextProvider *)nnn_textProviderByJoiningProvider:(nonnull CLKTextProvider *)provider1 andProvider:(nonnull CLKTextProvider *)provider2 withString:(nullable NSString *)joinString;
@end
@protrolium
protrolium / ffmpeg.md
Last active May 15, 2024 18:27
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with: