Skip to content

Instantly share code, notes, and snippets.

@aerobounce
aerobounce / macOS System Preference Pane Links.md
Last active April 19, 2024 14:26
macOS System Preference Pane Links
@sumitpore
sumitpore / chrome-local-storage-api.js
Last active February 9, 2024 05:19
Chrome's Local StorageArea API in Synchronous way for use in Chrome extensions. Replace 'chrome.storage.local' by 'chrome.storage.sync' if you want to use Sync StorageArea
/**
* Retrieve object from Chrome's Local StorageArea
* @param {string} key
*/
const getObjectFromLocalStorage = async function(key) {
return new Promise((resolve, reject) => {
try {
chrome.storage.local.get(key, function(value) {
resolve(value[key]);
});
@HashNuke
HashNuke / SwiftUI-SplitView-MacOS.swift
Last active January 5, 2024 18:53
Using a NSSplitViewController with SwiftUI on mac to render SwiftUI views as split panes. Drop this code into a playground to try it out. SORRY MAC-OS ONLY. DOES NOT WORK ON IOS
import AppKit
import SwiftUI
// Delete this line if not using a playground
import PlaygroundSupport
struct ContentView: View {
var body: some View {
// if spacing is not set to zero, there will be a gap after the first row
source $HOME/.zplug/init.zsh
# Make sure you use double quotes
zplug "zsh-users/zsh-history-substring-search"
zplug "zsh-users/zsh-syntax-highlighting"
# zplug "lib/theme-and-appearance", from:oh-my-zsh
# Node Plugins
zplug "lukechilds/zsh-nvm", as:plugin, use:"zsh/*.zsh"
@joshbetz
joshbetz / Webview.swift
Created February 12, 2020 15:36
A simple SwiftUI Webview
import SwiftUI
import WebKit
struct ContentView: View {
var body: some View {
Webview(url: URL(string: "https://google.com")!)
}
}
struct Webview: UIViewRepresentable {
@lisez
lisez / hugo-auto-deoply.yml
Last active January 9, 2024 15:10
如何使用 Github Actions 自動部署 Hugo
# link: https://sujingjhong.com/posts/how-to-deploy-hugo-automatically-with-github-actions/
# author: lisez <mm4324@gmail.com>
name: Auto publish to public site
# 只有推送到 master 才自動化
on:
push:
branches:
- master
@mrpcalcantara
mrpcalcantara / SnapshotDiffableDataSource.swift
Last active April 5, 2023 20:24
Example on how to use the UITableViewDiffableDataSource
//
// SnapshotDiffableDataSource.swift
// testDiffableDataSource
//
// Created by Miguel Alcântara on 22/01/2020.
// Copyright © 2020 Miguel Alcântara. All rights reserved.
//
import UIKit
// From https://stackoverflow.com/a/58985069/118631
@available(macOS 10.15, *)
func canRecordScreen() -> Bool {
let runningApplication = NSRunningApplication.current
let processIdentifier = runningApplication.processIdentifier
guard let windows = CGWindowListCopyWindowInfo([.optionOnScreenOnly], kCGNullWindowID)
as? [[String: AnyObject]] else
{
@unnamedd
unnamedd / MacEditorTextView.swift
Last active April 16, 2024 10:18
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
//
//
// NTSolar.swift
//
// Created by Neil Tiffin on 5/8/19.
// Copyright © 2019 Performance Champions, Inc.
// Copyright © 2019 Neil Tiffin.
//
// Released to the public domain by Neil Tiffin, May 2019
// Released to the public domain by Performance Champions, Inc., May 2019