Skip to content

Instantly share code, notes, and snippets.

@HereOrCode
HereOrCode / Switch configuration file.json
Last active November 13, 2021 13:23
Configuration file differences
{
"commands": [
{
"Work": [
{
"cmd": "ping www.bing.com",
"name": "Ping Bing"
},
{
"cmd": "ps aux",
@HereOrCode
HereOrCode / notification.swift
Created November 8, 2021 02:18
Deliver an OSX notification with Swift
// Remember: import UserNotifications
func sendNotification(title: String, body: String = "") {
let content = UNMutableNotificationContent()
content.title = title
if body.count > 0 {
content.body = body
}
@HereOrCode
HereOrCode / ScreenRecordPermission.swift
Created November 4, 2021 13:48
Check Screen Record Permission
import Cocoa
struct ScreenRecordPermission {
static var hasPermission: Bool {
permissionCheck()
}
static func permissionCheck() -> Bool {
if #available(macOS 10.15, *) {
let runningApplication = NSRunningApplication.current
@HereOrCode
HereOrCode / Codable Nested Data.swift
Last active October 22, 2021 05:03
Swift: Codable Nested Data
import UIKit
import SwiftPrettyPrint
/*
* SwiftPrettyPrint
* https://github.com/YusukeHosonuma/SwiftPrettyPrint
*/
class ViewController: UIViewController {
@HereOrCode
HereOrCode / read.md
Created October 17, 2021 04:57
github repo

…or create a new repository on the command line

echo "# fhefh2015.github.io" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:fhefh2015/fhefh2015.github.io.git
git push -u origin main
@HereOrCode
HereOrCode / Utils.swift
Created August 30, 2021 07:26
SwiftUI-Debug
//
// Utils.swift
// SwiftUIAppleDemo
//
// Created by Apple on 2021/8/30.
//
import Foundation
import SwiftUI