Skip to content

Instantly share code, notes, and snippets.

View JoshuaSullivan's full-sized avatar

Joshua Sullivan JoshuaSullivan

View GitHub Profile
@JoshuaSullivan
JoshuaSullivan / midjourney-quickstart.md
Last active July 29, 2023 20:55
Midjourney Quick-Start Guide
View midjourney-quickstart.md

Midjourney Quick-Start Guide

Midjourney is a commercial image generation and transformation AI service. Similar services include:

  • DALL-E 2 (Microsoft)
  • Nightcafe
  • Stable Diffusion (Open Source)

Midjourney is a somewhat opinionated AI and tends to try to create "art". It has a very high level of coherence, which means elements in the resulting images tend to have natural relationships with a low level of glitches and random weirdness. In my opinion, Midjourney has much higher quality "out of the box", trouncing the competition unless the user is quite advanced at effectively utilizing both positive and negative prompt particles.

@JoshuaSullivan
JoshuaSullivan / DataParser.swift
Last active November 21, 2020 17:13
A helper for translating Advent of Code puzzle input into usable values.
View DataParser.swift
import Foundation
/// A type that can be initialized from a string value.
///
public protocol StringInitable {
/// Initialize the object with a string.
///
/// - Note: This operation can fail if the string is not valid for this object type.
///
init?(_ string: String)
@JoshuaSullivan
JoshuaSullivan / ColorAbsoluteDifference.txt
Created October 11, 2020 22:44
Enumerations of the 3 new CoreImage Filters in iOS 14.0
View ColorAbsoluteDifference.txt
=========================
Color Absolute Difference
=========================
[Availability]
iOS: 14
macOS: 11.0
[Categories]
Color Adjustment, Video, Interlaced, Non-Square Pixels, Still Image, Built-In
@JoshuaSullivan
JoshuaSullivan / CoreImageFilterEnumeration.swift
Created October 11, 2020 22:35
A Swift Playground that will enumerate the properties of all of the CoreImage filters.
View CoreImageFilterEnumeration.swift
import Foundation
import CoreImage
struct FilterInput {
struct ValueRange {
let minValue: Float
let maxValue: Float
let sliderMin: Float?
let sliderMax: Float?
@JoshuaSullivan
JoshuaSullivan / synonym-search.swift
Created March 30, 2020 22:21
Uses the NaturalLanguage framework combined with a thesaurus API to replace adjectives in a sentence with synonyms. This is designed to be run in a Swift Playground.
View synonym-search.swift
import UIKit
import NaturalLanguage
import PlaygroundSupport
//: Your secret API key from `https://dictionaryapi.com` goes here.
//: THIS WON'T WORK UNLESS YOU GET A KEY.
let thesaurusKey = ""
//: The string you want to work on.
var testString = "The bright sun set behind the green hills. Thin clouds streaked the red sky."
@JoshuaSullivan
JoshuaSullivan / display-link-combine-playground.swift
Created November 10, 2019 00:14
This gist demonstrates how we can wrap CADisplayLink to get frame refresh events via a published stream rather than the traditional `target:selector:` methodology.
View display-link-combine-playground.swift
@JoshuaSullivan
JoshuaSullivan / core-image-filters-ios-13.md
Last active July 29, 2023 21:50
An enumeration of iOS 13 Core Image filters.
View core-image-filters-ios-13.md
@JoshuaSullivan
JoshuaSullivan / AnalyticsBackEndProtocol.swift
Created December 18, 2018 21:17
A guide to mocking objects with static methods...
View AnalyticsBackEndProtocol.swift
protocol AnalyticsBackEnd {
static func log(_ name: String)
}
extension Analytics: AnalyticsBackEnd {}
@JoshuaSullivan
JoshuaSullivan / UIImage.Orientation+Correction.swift
Created December 3, 2018 17:32
An extension on `UIImage.Orientation` to convert it to the corresponding `CGImagePropertyOrientation` case.
View UIImage.Orientation+Correction.swift
extension UIImage.Orientation {
/// Get the equivalent `CGImagePropertyOrientation` enum case.
var cgOrientation: CGImagePropertyOrientation {
switch self {
case .up: return .up
case .down: return .down
case .left: return .left
case .right: return .right
case .upMirrored: return .upMirrored
case .downMirrored: return .downMirrored