Skip to content

Instantly share code, notes, and snippets.

View JoshuaSullivan's full-sized avatar

Joshua Sullivan JoshuaSullivan

View GitHub Profile
@JoshuaSullivan
JoshuaSullivan / ColorCubeHelper-swift2.swift
Last active April 17, 2024 10:48
Here are the Swift 2.3 and Swift 3.0 versions of the ColorCubeHelper class.
//
// ColorCubeHelper.swift
//
// Created by Joshua Sullivan on 10/01/16.
// Copyright © 2016 Joshua Sullivan. All rights reserved.
//
import UIKit
import Accelerate
@JoshuaSullivan
JoshuaSullivan / core-image-filters-ios-13.md
Last active March 19, 2024 15:17
An enumeration of iOS 13 Core Image filters.

Core Image Filters

iOS 13 has 218 filters.

New Filters in iOS 13

  • CIDocumentEnhancer
  • CIGaborGradients
  • CIKeystoneCorrectionCombined
  • CIKeystoneCorrectionHorizontal
  • CIKeystoneCorrectionVertical
@JoshuaSullivan
JoshuaSullivan / mobius-ring.pde
Created March 22, 2018 02:04
Processing script for rendering a Möbius Strip.
class MobiusRing {
float majorRadius, minorRadius;
int segments;
PVector[] vertices;
MobiusRing(float majorRadius, float minorRadius, int segments) {
this.majorRadius = majorRadius;
this.minorRadius = minorRadius;
this.segments = segments;
@JoshuaSullivan
JoshuaSullivan / core-image-filters.md
Last active January 5, 2024 15:18
Core Image Filter Details

Core Image Filters

iOS 12.2 has 207 filters.

Accordion Fold Transition (CIAccordionFoldTransition)

First available: iOS 8

Transitions from one image to another of a differing dimensions by unfolding.

@JoshuaSullivan
JoshuaSullivan / Grid.swift
Last active December 19, 2023 17:16
A data structure representing a 2D grid of homogeneous values. Has methods for examining data geometrically and avoids out-of-range exceptions that are common when working with Arrays.
/// Represents a point on a grid.
///
/// - Note: Instances of this type are not bound to any particular Grid and may be invalid depending on the size of the grid.
///
public struct GridCoordinate: Equatable, Hashable, CustomStringConvertible {
/// The column (East/West) position of this coordinate.
public let x: Int
/// The row (North/South) position of this coordinate.
@JoshuaSullivan
JoshuaSullivan / CoreImageFilterEnumeration.swift
Created October 11, 2020 22:35
A Swift Playground that will enumerate the properties of all of the CoreImage filters.
import Foundation
import CoreImage
struct FilterInput {
struct ValueRange {
let minValue: Float
let maxValue: Float
let sliderMin: Float?
let sliderMax: Float?
@JoshuaSullivan
JoshuaSullivan / midjourney-quickstart.md
Last active July 29, 2023 20:55
Midjourney Quick-Start Guide

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 / PerlinNoise.cikernel
Last active July 10, 2023 22:51
My attempt at writing a Perlin Noise function.
// Improved Noise - Copyright 2002 Ken Perlin.
// Adapted and updated for iOS by Joshua Sullivan, 2016.01.12
// Apply the function 6t^5 - 15t^4 + 10t^3
float fade(float t)
{
return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
}
// I'm keeping this around for reference.
@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.
@JoshuaSullivan
JoshuaSullivan / ColorCubeImageCreator-swift2.swift
Last active April 25, 2023 16:45
The Color Cube Image Creator creates the specially formatted images needed to create data for the CIColorCube filter.
//
// ColorCubeImageCreator.swift
// ColorCubeImageCreator
//
// Created by Joshua Sullivan on 4/25/16.
// Copyright © 2016 Joshua Sullivan. All rights reserved.
//
import UIKit