Skip to content

Instantly share code, notes, and snippets.

@alex-sherwin
alex-sherwin / ScrollableView.swift
Created June 14, 2021 01:21 — forked from jfuellert/ScrollableView.swift
A scrollable SwiftUI view, UIScrollView wrapper. ScrollableView lets you read and write content offsets for scrollview in SwiftUI, with and without animations.
import SwiftUI
struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable {
// MARK: - Coordinator
final class Coordinator: NSObject, UIScrollViewDelegate {
// MARK: - Properties
private let scrollView: UIScrollView
var offset: Binding<CGPoint>
@alex-sherwin
alex-sherwin / asciinema-to-scriptreplay
Created March 15, 2017 01:16 — forked from izabera/asciinema-to-scriptreplay
convert between asciinema and scriptreplay
#!/bin/bash
exec {times}> times {typescript}> typescript < "${1-/dev/stdin}"
while read -r; do [[ $REPLY = ' "stdout": [' ]] && break; done # skip to this line
LANG=C
printf "Script started on %(%c)T\n" -1 >&"$typescript" # dummy
while read -r open; [[ $open = '[' ]]; do
read -r elapsed; read -r string; read -r close
eval printf %b%n "$string" characters >&"$typescript" # put count in $characters
printf "%s %s\n" "${elapsed%,}" "$characters" >&"$times"
done

Cornerstone does not yet officially support Kaleidoscope 2, so to work with the latest beta of Kaleidoscope 2 (Build 99 and up) here is how to get set up:

Follow the instructions here Cornerstone External Compare Tools under the heading Custom Compare Scripts

The custom scripts contents should be

#!/usr/bin/env bash

/usr/local/bin/ksdiff --partial-changeset -- "$1" "$2"