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
@idleberg
idleberg / vscode-macos-context-menu.md
Last active May 1, 2024 12:01
“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 March 3, 2024 11:38
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 April 10, 2024 19:27
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.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 112b5d6..e6f790d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -552,6 +552,8 @@ else()
set(SWIFT_HOST_VARIANT_ARCH_default "powerpc64le")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "s390x")
set(SWIFT_HOST_VARIANT_ARCH_default "s390x")
+ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
+ set(SWIFT_HOST_VARIANT_ARCH_default "i686")