Skip to content

Instantly share code, notes, and snippets.

@unixzii
unixzii / WeatherView.swift
Created November 7, 2023 13:21
A demo of implementing iOS Weather card in SwiftUI.
import SwiftUI
struct HeaderView: View {
var body: some View {
HStack {
Image(systemName: "info.circle.fill")
.resizable()
.frame(width: 12, height: 12)
Text("Section Header")
.font(.system(size: 13))
@almonk
almonk / Notify.swift
Last active March 27, 2023 07:55
A little wrapper for NSNotifications with Swift
//
// Notify.swift
//
import Foundation
class Notify {
static let shared = Notify()
func send(event: NSNotification.Name) {
@NSExceptional
NSExceptional / Shell.swift
Created June 25, 2022 23:31
Leverage @dynamicMemberLookup to invoke shell commands dynamically
//
// Shell.swift
//
// Created by Tanner Bennett on 6/25/22.
// Copyright Tanner Bennett (c) 2022
//
import Foundation
extension StringProtocol {
@lexrus
lexrus / delete_all_imessage_conversations.applescript
Last active January 26, 2024 16:12
Delete all iMessage conversations. Compatible with macOS Monterey. Please check Reduce motion before launch this apple script.
# System Preferences -> Accessibility -> Display -> Reduce motion
tell application "Messages" to activate
tell application "Messages"
set chatCount to (count of chats)
end tell
tell application "System Events"
tell process "Messages"
@ShihabM
ShihabM / AppDelegate.gist
Created November 3, 2021 09:53
Dock Shooter - a game in your dock icon
//
// AppDelegate.swift
// Dock Shooter
//
// Created by Shihab Mehboob on 01/11/2021.
//
import Cocoa
@main
@cjwcommuny
cjwcommuny / MacEditorTextView.swift
Created October 31, 2021 10:46
An NSTextView wrapped by SwiftUI with TextKit 2
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
* Modified by https://github.com/cjwcommuny for TextKit 2
*/
import Combine
@biosmanager
biosmanager / userChrome.css
Last active August 21, 2024 21:33
Firefox Proton macOS Close Tab Left (updated for version 113)
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
.tabbrowser-tab .tab-close-button {
opacity: 0;
margin-left: -4.5px !important;
margin-right: 2px !important;
}
.tabbrowser-tab:not(:hover) .tab-close-button {
display: none;
@33eyes
33eyes / commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
Last active August 29, 2024 19:38
How to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally

Commit jupyter notebooks code to git and keep output locally

  1. Add a filter to git config by running the following command in bash inside the repo:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'  
  1. Create a .gitattributes file inside the directory with the notebooks

  2. Add the following to that file:

.toolbar {
ToolbarItemGroup {
Button(action: {}, label: {
Image(systemName: "sidebar.left")
})
Spacer()
Button(action: {}, label: {
Image(systemName: "play.fill")
})
Button(action: {}, label: {
@dpiponi
dpiponi / runner.py
Created August 27, 2020 15:34
Are these runners?
# Python 3
import collections
Write = collections.namedtuple("Write", ["written"])
def hello_world():
yield Write("Hello, world!")
yield Write("Hello, world!")
return 1
def identity(gen):