Skip to content

Instantly share code, notes, and snippets.

View carloe's full-sized avatar

Carlo Eugster carloe

View GitHub Profile
@swiftui-lab
swiftui-lab / SwiftUI-view-to-UIImage.swift
Created July 5, 2020 19:43
A method for converting a SwiftUI into a UIImage
//
// ContentView.swift
// Grabber
//
// SwiftUI-Lab
//
// For more information on the techniques used in this example, check
// The Power of the Hosting+Representable Combo (https://swiftui-lab.com/a-powerful-combo/)
import SwiftUI
@jfuellert
jfuellert / ScrollableView.swift
Last active June 7, 2024 02:55
A scrollable SwiftUI view, UIScrollView wrapper. ScrollableView lets you read and write content offsets for scrollview in SwiftUI, with and without animations.
import SwiftUI
struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable {
// MARK: - Coordinator
final class Coordinator: NSObject, UIScrollViewDelegate {
// MARK: - Properties
private let scrollView: UIScrollView
var offset: Binding<CGPoint>
@darrarski
darrarski / FetchedResultsPublisher.swift
Last active June 6, 2024 18:40
Swift-Combine-CoreData-Fetched-Results-Publisher
import Combine
import CoreData
public final class FetchedResultsPublisher
<ResultType>
: Publisher
where
ResultType: NSFetchRequestResult
{
@mhamilt
mhamilt / Notes.md
Last active February 19, 2023 20:17
Metal Compute Shader Example in Swift and Objective C

Notes

Create a command line target in xcode either in Swift or Obj-C. add a metal file to the project and copy and paste the respective code into each file.

@timothycosta
timothycosta / UIScrollViewWrapper.swift
Created July 5, 2019 03:25
UIScrollView wrapped for SwiftUI
//
// UIScrollViewWrapper.swift
// lingq-5
//
// Created by Timothy Costa on 2019/07/05.
// Copyright © 2019 timothycosta.com. All rights reserved.
//
import SwiftUI
@htr3n
htr3n / macos-ramdisk.md
Last active July 18, 2024 08:22
Creating RAM disk in macOS

Built-in

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.

Notes:

@knoopx
knoopx / README.md
Last active June 17, 2024 16:16
Creality Ender 3 Stock Factory Vref

Creality3D v1.1.2 stock vref values

A4988 Drivers
Vref set to ~90% of stepper rated current
Rs = 0.1ohm

X = 0,58v (0,725A)
Y = 0,58v (0,725A)
Z = 0,58v (0,725A)
@matthewdowney
matthewdowney / segwit-xpubs.md
Created May 15, 2018 01:55
Figuring out how to get segwit balances for an HD wallet via an xpub with blockchain.info's API.

Issues with the Blockchain Info API

The blockchain.info API for XPUBs only works with Legacy Bitcoin XPUBs, whereas their web interface confusingly works with Segwit as well.

I provide a couple solutions at the end, and we end up with three useful functions:

  • legacy_wallet_balance
  • segwit_wallet_balance
  • segwit_wallet_balance_hack
@rsp
rsp / GitHub-Project-Guidelines.md
Last active June 11, 2024 12:41
Git Strict Flow and GitHub Project Guidelines - setup rules and git flow for commercial and open-source projects by @rsp

Git Strict Flow and GitHub Project Guidelines

Or how to turn this:

into this:

@NatashaTheRobot
NatashaTheRobot / WatchConnectivitySingletonDemo.swift
Last active May 21, 2024 18:21
WatchConnectivity Singleton Demo
//
// WatchSessionManager.swift
// WatchConnectivityDemo
//
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import WatchConnectivity