Skip to content

Instantly share code, notes, and snippets.

View stevelandeyasana's full-sized avatar

Steve Landey stevelandeyasana

  • Asana
  • San Francisco, CA
  • X @irskep
View GitHub Profile
@stevelandeyasana
stevelandeyasana / PDFPageView.swift
Created February 10, 2020 23:16
A UIView that renders a PDF page at a given resolution and constrains itself to the PDF page's aspect ratio
// Uses Cartography for layout, but you should be able to translate it to NSLayoutConstraint pretty easily
import Cartography
/// Render a single page of a PDF, non-interactive, at an arbitrary size.
/// Adds its own constraint to maintain its correct aspect ratio.
class PDFPageView: UIView {
var displayBox: PDFDisplayBox = .artBox
var majorAxisLength: CGFloat = 2048
var page: PDFPage? { didSet { applyState() } }
@stevelandeyasana
stevelandeyasana / XcodeAlfred.osascript
Created May 15, 2019 21:56
AppleScript to toggle between Xcode and Simulator
on alfred_script(q)
tell application "System Events" to set FrontAppName to name of first process where frontmost is true
if FrontAppName is "Xcode" then
tell app "Simulator" to activate
else
tell app "Xcode" to activate
end if
@stevelandeyasana
stevelandeyasana / hide_native_tabs.css
Created March 19, 2019 19:34
CSS to hide Firefox's tab bar but keep macOS window buttons (close/minimize/maximize)
/* add to your userChrome.css */
#TabsToolbar {
visibility: collapse;
overflow: visible;
}
#TabsToolbar > * {
visibility: collapse;
}