Skip to content

Instantly share code, notes, and snippets.

View TimOliver's full-sized avatar
😆
Out for a byte. Back in a bit.

Tim Oliver TimOliver

😆
Out for a byte. Back in a bit.
View GitHub Profile
@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active November 3, 2024 16:25
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@bgayman
bgayman / FilterCam.swift
Last active September 25, 2022 00:42
Setup AVCaptureSession with CIFilter
//
// ViewController.swift
// CameraFilter
//
import UIKit
import AVFoundation
class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate {
func minMax(array: [Int]) -> (min: Int, max: Int) {
var minActual = array[0]
var maxActual = array[0]
for valor in array[1..<array.count] {
if valor < minActual {
minActual = valor
} else if valor > maxActual {
maxActual = valor
}
}
@levantAJ
levantAJ / UIImageToCMSampleBuffer
Last active October 12, 2022 03:02
Create CMSampleBuffer from UIImage
import ImageIO
import AVFoundation
var cvPixelBuffer: CVPixelBuffer? {
var pixelBuffer: CVPixelBuffer? = nil
let options: [NSObject: Any] = [
kCVPixelBufferCGImageCompatibilityKey: false,
kCVPixelBufferCGBitmapContextCompatibilityKey: false,
]
let status = CVPixelBufferCreate(kCFAllocatorDefault, Int(size.width), Int(size.height), kCVPixelFormatType_32BGRA, options as CFDictionary, &pixelBuffer)
@citrusui
citrusui / dropdown.md
Last active May 10, 2025 18:03
"Dropdowns" in Markdown
How do I dropdown?
This is how you dropdown.

<details>
<summary>How do I dropdown?</summary>
<br>
This is how you dropdown.
@ashfurrow
ashfurrow / Fresh macOS Setup.md
Last active October 14, 2024 10:28
All the stuff I do on a fresh macOS Installation

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 3
  • Airmail 3
  • iA Writer
@czwen
czwen / gist:567f731173b2e33add720424a3ce836e
Created July 1, 2016 07:41
inject dylib into simulator
xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib
xcrun simctl spawn booted launchctl stop com.apple.SpringBoard
@JaviSoto
JaviSoto / SampleViewController.swift
Last active January 23, 2020 09:20
Init based Storyboard View Controller Instantiation
final class SampleViewController: StoryboardBackedViewController {
// Unfortunately this must be an IUO var, so that we can set the value after super.init
private var member: Foo!
// Proper dependency injection in a storyboard backed VC!
init(foo: Foo) {
super.init(storyboardIdentifier: "SampleViewControllerIdentifier")
// We have to set the members *after* calling super.init, since it changes the instance of `self`.
self.member = foo
@graphitemaster
graphitemaster / T0.md
Last active January 6, 2025 08:29
Vulkan Tutorial

Tutorial 0

What is Vulkan

Vulkan is a low-overhead, cross-platform 3D graphics and compute API.

Vulkan targets

Vulkan targets high-performance realtime 3D graphics applications such as games and interactive media across multiple platforms providing higher performance and lower CPU usage.