Skip to content

Instantly share code, notes, and snippets.

View ionel71089's full-sized avatar
๐ŸŽ
Eating an apple.

Ionel Lescai ionel71089

๐ŸŽ
Eating an apple.
View GitHub Profile
name explain-diff-html
description Use when the user asks for a rich explanation of a code change, diff, branch, or PR. Produces HTML output.

Explain Diff

Please make me a rich, interactive explanation of the specified code change.

It should have these sections:

@idleberg
idleberg / vscode-macos-context-menu.md
Last active October 13, 2026 03:55
โ€œOpen in Visual Studio Codeโ€ in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set โ€œService receives selectedโ€ to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (โ€Catalinaโ€) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do ๐Ÿ˜‰
@simonbs
simonbs / UserDefault.swift
Last active August 2, 2025 16:09
Property wrapper that stores values in UserDefaults and works with SwiftUI and Combine.
/**
* I needed a property wrapper that fulfilled the following four requirements:
*
* 1. Values are stored in UserDefaults.
* 2. Properties using the property wrapper can be used with SwiftUI.
* 3. The property wrapper exposes a Publisher to be used with Combine.
* 4. The publisher is only called when the value is updated and not
* when_any_ value stored in UserDefaults is updated.
*
* First I tried using SwiftUI's builtin @AppStorage property wrapper
@jordansinger
jordansinger / Settings.swift
Created February 20, 2021 18:30
iOS 6 Settings built in SwiftUI
//
// Settings.swift
// Settings
//
// Created by Jordan Singer on 2/20/21.
//
import SwiftUI
struct Settings: View {
@davidsteppenbeck
davidsteppenbeck / PreviewProviderModifier.swift
Last active October 31, 2022 10:30
A SwiftUI view modifier for simple preview providers.
import SwiftUI
enum PreviewProviderMode: CaseIterable {
/// Use for a light appearance preview.
case lightMode
/// Use for a dark appearance preview.
case darkMode
@izakpavel
izakpavel / .lldbinit
Created April 16, 2020 10:25
example of a custom lldb command that prints Data as String
# example of a custom lldb command that prints Data as String
# store in your home (~) directory
command regex printData 's/(.+)/expr print(String(data: %1, encoding: .utf8))/'
@maxchuquimia
maxchuquimia / kill_sim_clones.sh
Last active January 27, 2024 23:17
Shutdown all Simulator clones created by Xcode when running tests
xcrun simctl --set testing list | grep Booted | grep Clone | sed 's/^.*(\([A-Z0-9\-]*\)).*$/\1/g' | xargs -I {} xcrun simctl --set testing shutdown "{}"
@DominikPetho
DominikPetho / .swift
Last active September 15, 2020 07:36
Sample of Swift property wrappers for unit testing
import UIKit
@propertyWrapper
struct Printer<T> {
public var currentValue: T?
var wrappedValue: T? {
get {
print("Property wrapper value printed", currentValue)
@AvdLee
AvdLee / Flattener Playground
Created August 7, 2019 15:24
A Flattener written in Swift
/// - We have multiple files with a X amount of chunks
/// - Each batch request can contain a max of 50 chunks from possibly multiple files
///
/// Challenge: Distribute the chunk requests over as less batch requests as possible
import UIKit
import Foundation
typealias PublicIdentifier = String
@MichaelPolla
MichaelPolla / github-resize-pictures.md
Last active May 11, 2026 01:14
Markdown - Resize pictures in GitHub, including in comments comment

Markdown - Resize pictures in GitHub

I found that the "best" way is to use HTML, as it works both in Readme/.md files and also in comments (within Issues, Gist...)

E.g. when adding/editing a comment (within Issues, Gist...) :

  • Upload the picture by drag-and-drop in the text field
  • replace ![image](https://your-image-url.type) with <img src="https://your-image-url.type" width="100" height="100">

As mentioned by @cbestow (thanks!), it's not mandatory to set both width and height. If only one is set, the other will be adjusted accordingly to preserve the aspect ratio of the image.