Skip to content

Instantly share code, notes, and snippets.

View plam4u's full-sized avatar
🏠
Working from home

Plamen Andreev plam4u

🏠
Working from home
View GitHub Profile
@zenorocha
zenorocha / README.md
Last active April 6, 2024 16:59
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@edwinlee
edwinlee / Code.gs
Last active February 21, 2024 10:43
Sync a Google Sheets spreadsheet to a Firebase Realtime database
/**
* Copyright 2019 Google LLC.
* SPDX-License-Identifier: Apache-2.0
*/
function getEnvironment() {
var environment = {
spreadsheetID: "<REPLACE WITH YOUR SPREADSHEET ID>",
firebaseUrl: "<REPLACE WITH YOUR REALTIME DB URL>"
};
@IanKeen
IanKeen / Example_Complex.swift
Last active January 23, 2024 07:53
PropertyWrapper: @transaction binding for SwiftUI to make changes to data supporting commit/rollback
struct User: Equatable {
var firstName: String
var lastName: String
}
@main
struct MyApp: App {
@State var value = User(firstName: "", lastName: "")
@State var showEdit = false
@mattt
mattt / UIViewControllerPreview.swift
Last active January 8, 2024 23:09
Generic structures to host previews of UIView and UIViewController subclasses.
import UIKit
#if canImport(SwiftUI) && DEBUG
import SwiftUI
struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable {
let viewController: ViewController
init(_ builder: @escaping () -> ViewController) {
viewController = builder()
}
@andreibosco
andreibosco / creative-cloud-disable.md
Last active January 3, 2024 02:37
disable creative cloud startup on mac
@vogler
vogler / Artillery-Genius.md
Last active December 27, 2023 12:48
Artillery Genius Config

image

Software

  • Mainboard firmware: Marlin 2.0.9.2 (fork with config, see Marlin/Configuration{,_adv}.h)
    • diff: nvim -d {Marlin,config/Artillery/Genius}/Configuration.h, same for Configuration_adv.h
      • mostly calibration, new extruder and noise-free PWM for parts fan
      • LIN_ADVANCE instead of S_CURVE_ACCELERATION (don't work together)
    • before 13.11.2020: Marlin 2.0.5.3 (3dprintbeginner) (branch)
  • TFT firmware: artillery_tft_fw_1.27.x_patch_9.2 (digant@thingiverse) (TFT-config.ini)
    • Put in Marlin mode (long press, persists on reboot) when printing with OctoPrint because TFT shares serial connection.
@leoiphonedev
leoiphonedev / UITapGesture.swift
Last active November 28, 2023 12:45
Extension for UITapGesture that contains a function to detect range of particular text in UILabel's text.
extension UITapGestureRecognizer {
func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool {
// Create instances of NSLayoutManager, NSTextContainer and NSTextStorage
let layoutManager = NSLayoutManager()
let textContainer = NSTextContainer(size: CGSize.zero)
let textStorage = NSTextStorage(attributedString: label.attributedText!)
// Configure layoutManager and textStorage
layoutManager.addTextContainer(textContainer)
@mokagio
mokagio / install-xcode-cli-tools.sh
Created September 9, 2015 09:28
Install Xcode CLI Tools without GUI
#!/bin/bash
# See http://apple.stackexchange.com/questions/107307/how-can-i-install-the-command-line-tools-completely-from-the-command-line
echo "Checking Xcode CLI tools"
# Only run if the tools are not installed yet
# To check that try to print the SDK path
xcode-select -p &> /dev/null
if [ $? -ne 0 ]; then
echo "Xcode CLI tools not found. Installing them..."
@IanKeen
IanKeen / EntryPoint.swift
Last active August 17, 2023 03:33
Example main.swift
import Foundation
import SwiftUI
let isUITesting = /* your UI test detection here */
@main
struct EntryPoint {
static func main() {
if isUITesting {
UITestApp.main()
@IanKeen
IanKeen / Publisher+Result.swift
Created July 14, 2020 17:18
Extension to convert a failable Publisher into a non-failable Result based publisher (as well as extensions to break out values/errors) - Same idea as RxSwifts Materialize
extension Publisher {
func asResult() -> AnyPublisher<Result<Output, Failure>, Never> {
return map(Result.success)
.catch { Just(Result.failure($0)) }
.eraseToAnyPublisher()
}
}
extension Publisher {
func values<S, F: Error>() -> AnyPublisher<S, Never> where Output == Result<S, F>, Failure == Never {