This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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]); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import WebKit | |
struct ContentView: View { | |
var body: some View { | |
Webview(url: URL(string: "https://google.com")!) | |
} | |
} | |
struct Webview: UIViewRepresentable { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# link: https://sujingjhong.com/posts/how-to-deploy-hugo-automatically-with-github-actions/ | |
# author: lisez <[email protected]> | |
name: Auto publish to public site | |
# 只有推送到 master 才自動化 | |
on: | |
push: | |
branches: | |
- master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SnapshotDiffableDataSource.swift | |
// testDiffableDataSource | |
// | |
// Created by Miguel Alcântara on 22/01/2020. | |
// Copyright © 2020 Miguel Alcântara. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MacEditorTextView | |
* Copyright (c) Thiago Holanda 2020-2021 | |
* https://bsky.app/profile/tholanda.com | |
* | |
* (the twitter account is now deleted, please, do not try to reach me there) | |
* https://twitter.com/tholanda | |
* | |
* MIT license | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from: | |
// https://gist.github.com/joelcox/28de2f0cb21ea47bd789 | |
NSColor.selectedMenuItemColor.set() | |
NSBezierPath(rect: rect).fill() | |
if rect.height > 1 { | |
let currentControlTint = NSColor.currentControlTint | |
let startingAlpha: CGFloat = currentControlTint == .blueControlTint ? 0.16 : 0.09 |