Skip to content

Instantly share code, notes, and snippets.

View mhergon's full-sized avatar

Marc Hervera Gonzalez mhergon

View GitHub Profile
@stoqn4opm
stoqn4opm / SharedOffsetCollectionView.swift
Created May 21, 2020 05:57
`UICollectionView` subclass that makes all its instances have the same scroll offset. When one instance scrolls all others will follow to the same content offset.
import UIKit
// MARK: - Notifications
extension Notification.Name {
/// Posted everytime when a `SharedOffsetCollectionView` scrolls. The object is the instances that got scrolled.
fileprivate static let didScroll = Notification.Name(rawValue: "SharedContentOffset.didScroll")
@dlueth
dlueth / mdnsresponder.sh
Last active April 16, 2022 03:02
Replace Yosemite's DNS discoveryd with the former mDNSResponder.
#!/bin/bash
if [ ! $(whoami) = 'root' ]; then
echo "This script should be run as root." > /dev/stderr
exit 1
fi
spinner()
{
local pid=$!