Skip to content

Instantly share code, notes, and snippets.

View ABridoux's full-sized avatar
:octocat:

Alexis Bridoux ABridoux

:octocat:
View GitHub Profile
extension Result {
public func `catch`(_ handler: () throws -> Success) -> Result<Success, Error> {
flatMapError { _ in
.init { try handler() }
}
}
public func `catch`(_ handler: (Failure) throws -> Success) -> Result<Success, Error> {
flatMapError { error in
.init { try handler(error) }
@SergLam
SergLam / Animation.md
Created December 4, 2020 10:40 — forked from JeOam/Animation.md
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

@CanTheAlmighty
CanTheAlmighty / DisplayLink.swift
Last active March 10, 2024 08:43
DisplayLink for OSX
@robotconscience
robotconscience / SelectAudioOutput.mm
Created April 8, 2015 15:07
Set CoreAudio ouput device for your app
// change this to a recognizeable piece of your audio output
// e.g. setAudioOutput("AirPlay"); or setAudioOutput("VoilaDevice");
// returns true on success / false on beef
// as always, all thanks to StackOverflow for the amazing
// enumerate devices script:
// http://stackoverflow.com/questions/1983984/how-to-get-audio-device-uid-to-pass-into-nssounds-setplaybackdeviceidentifier
// Note: if you change "kAudioDevicePropertyScopeOutput" to "kAudioObjectPropertyScopeGlobal" in line 62,
// you can set the output for your whole system...
@bland-industries
bland-industries / StartUpWorkspaces
Created February 26, 2015 15:33
Applescript to place specific window at full screen when there are multiple monitors. Works with some caveats.
set duetApps to {"Mail", "HipChat", "Console", "iTerm"}
set laptopApps to {"Safari", "Google Chrome", "Tower"}
set topApps to {"Sublime"}
-- toggle full screen
on toggleFullScreen()
set isFullScreenAfter to false
tell application "System Events"
@mikestone14
mikestone14 / gist:11198630
Created April 23, 2014 00:08
Getting a GoDaddy domain to point to a Heroku app.