Skip to content

Instantly share code, notes, and snippets.

View msewell's full-sized avatar

Michael Sewell msewell

View GitHub Profile
import lldb
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f SwiftPrinter.printer pjson')
def printer(debugger, command, result, internal_dict):
debugger.HandleCommand('p print(String(data: try! JSONSerialization.data(withJSONObject:' + command + ', options: .prettyPrinted), encoding: .utf8 )!)')
@freak4pc
freak4pc / Combine+WithLatestFrom.swift
Last active February 19, 2024 15:35
withLatestFrom for Apple's Combine
//
// Combine+WithLatestFrom.swift
//
// Created by Shai Mishali on 29/08/2019.
// Copyright © 2019 Shai Mishali. All rights reserved.
//
import Combine
// MARK: - Operator methods
@freak4pc
freak4pc / Cart.swift
Last active September 7, 2018 13:39
Simple (Naive) Rx Cart
struct Cart {
private let action = PublishRelay<Action>()
public let items: Observable<[Item]>
init() {
items = action
.scan([Item]()) { items, action in
switch action {
case .add(let item):
return items + [item]
#!/sbin/openrc-run
description="node_exporter"
: ${NODE_PIDFILE:=/var/run/node_exporter.pid}
: ${NODE_USER:=root}
depend() {
need net
need localmount
@kean
kean / AutoRetry.swift
Last active September 20, 2023 20:21
Smart Auto Retry using RxSwift
// The MIT License (MIT)
//
// Copyright (c) 2017 Alexander Grebenyuk (github.com/kean).
import Foundation
import RxSwift
import RxCocoa
extension ObservableType {
@beccadax
beccadax / UserDefaults+Codable.swift
Last active June 29, 2021 12:52
Encode Codable instances into UserDefaults. Use only with small instances.
//
// UserDefaults+Codable.swift
// Converter UltraLight
//
// Created by Brent Royal-Gordon on 8/31/17.
// Copyright © 2017 Architechies. All rights reserved.
// MIT-licensed, go nuts with it.
//
import Foundation
//
// PaginationNetworkLogic.swift
//
// Created by Daniel Tartaglia on 4/9/17.
// Copyright © 2019 Daniel Tartaglia. MIT License
//
import RxSwift
struct PaginationUISource {
@rubenerd
rubenerd / adobe-cc-mac-uninstall.sh
Created August 31, 2015 00:01
Remove Adobe Creative Cloud from OS X
#!/bin/sh
rm -rf "/Applications/Adobe*"
rm -rf "~/Library/Application Support/Adobe/"
rm -rf "~/Library/Caches/Adobe*/"
sudo rm -rf "/Applications/Utilities/Adobe*"
sudo rm -rf "/Library/Application Support/Adobe/"
sudo rm -rf "/Users/Shared/Adobe/"
@cristianca
cristianca / Create color with gradient
Last active April 14, 2023 18:25
Create a gradient UIColor from an array of colors.
func colorWithGradient(frame: CGRect, colors: [UIColor]) -> UIColor {
// create the background layer that will hold the gradient
let backgroundGradientLayer = CAGradientLayer()
backgroundGradientLayer.frame = frame
// we create an array of CG colors from out UIColor array
let cgColors = colors.map({$0.CGColor})
backgroundGradientLayer.colors = cgColors