Skip to content

Instantly share code, notes, and snippets.

Zev Eisenberg ZevEisenberg

Block or report user

Report or block ZevEisenberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ZevEisenberg
ZevEisenberg / Files changed during macOS Security Update 2017-001 installation.txt
Created Nov 29, 2017
Files changed during macOS Security Update 2017-001 installation
View Files changed during macOS Security Update 2017-001 installation.txt
11:55:09 AM ↗️ 0x15900 /Users/zev/Library/Preferences/com.apple.spaces.plist.P2AbRcF
11:55:09 AM ↘️ 0x10800 /Users/zev/Library/Preferences/com.apple.spaces.plist
11:55:09 AM ↗️ 0x15900 /Users/zev/Library/Preferences/com.tristan.FSMonitor.plist.cR5WRLP
11:55:09 AM ↘️ 0x10800 /Users/zev/Library/Preferences/com.tristan.FSMonitor.plist
11:55:09 AM 🆕 0x14100 /Users/zev/Library/Preferences/ByHost/com.apple.loginwindow.0922F432-94E3-55A1-8672-6B66E786F21B.plist.8jDpEFP
11:55:10 AM ↗️ 0x15900 /Users/zev/Library/Preferences/ByHost/com.apple.loginwindow.0922F432-94E3-55A1-8672-6B66E786F21B.plist.8jDpEFP
11:55:10 AM ↘️ 0x10800 /Users/zev/Library/Preferences/ByHost/com.apple.loginwindow.0922F432-94E3-55A1-8672-6B66E786F21B.plist
11:55:10 AM 🛠 0x18000 /private/var/db/diagnostics/Persist/0000000000000283.tracev3
11:55:10 AM 🆕 0x14100 /Users/zev/Library/Preferences/com.tristan.FSMonitor.plist.tbghtkX
11:55:10 AM ❌ 0x11300 /Users/zev/Library/Caches/at.obdev.LaunchBar/IndexingProgressLog.plist
@ZevEisenberg
ZevEisenberg / apple-dev.zsh
Created Jul 22, 2017
Utility functions for doing iOS and Mac development
View apple-dev.zsh
# cd to the folder containing an Xcode project dragged from an Xcode window's proxy icon. If no file is provided, cd to the folder containing the current Xcode project
function xc
{
xcodeIsRunning=false
if [[ `osascript -e 'tell app "System Events" to count processes whose name is "Xcode"'` == 1 ]]; then
xcodeIsRunning=true
fi
if [[ $xcodeIsRunning == false ]]; then
echo "Xcode is not open. I don’t know what you want from me."
@ZevEisenberg
ZevEisenberg / version_copy_functions.sh
Created Jul 22, 2017
Functions to copy versions of Xcode, browsers, and macOS
View version_copy_functions.sh
function copySafariVersion
{
local safariVersion=$(defaults read /Applications/Safari.app/Contents/Info CFBundleShortVersionString)
local safariBuild=$(defaults read /Applications/Safari.app/Contents/Info CFBundleVersion)
local macOSVersion=$(sw_vers -productVersion)
local macOSBuild=$(sw_vers -buildVersion)
local fullString="Safari ${safariVersion} (${safariBuild}) on macOS ${macOSVersion} (${macOSBuild})"
echo "Copied \"$fullString\""
echo -n $fullString | pbcopy
}
@ZevEisenberg
ZevEisenberg / NS Prefix Finder.txt
Created Mar 30, 2017
Regex for finding NS prefixes in code migrated to Swift 3
View NS Prefix Finder.txt
[^(CONDITIO)]NS[^(Error)|^(Coder)|^(Managed)|^(Attributed)|^(LayoutConstraint)|^(Predicate)|^(FetchRequest)|^(Null)|^(KeyValue)]
@ZevEisenberg
ZevEisenberg / LICENSE
Last active Feb 3, 2018
Smoothly deselect table and collection view cells on dismissal, including interactive dismiss and interactively-partially-dismiss-then-cancel-then-dismiss-again
View LICENSE
The MIT License (MIT)
Copyright (c) 2016 Zev Eisenberg
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@ZevEisenberg
ZevEisenberg / map float range.swift
Last active Oct 14, 2018
Mapping floating point numbers between two ranges in Swift
View map float range.swift
import QuartzCore
extension CGFloat {
func map(from from: ClosedInterval<CGFloat>, to: ClosedInterval<CGFloat>) -> CGFloat {
let result = ((self - from.start) / (from.end - from.start)) * (to.end - to.start) + to.start
return result
}
}
extension Double {
@ZevEisenberg
ZevEisenberg / traits.m
Created Dec 14, 2015
Version of a UIFont with different symbolic traits
View traits.m
static UIFont *versionOfFontWithSymbolicTraits(UIFont *font, UIFontDescriptorSymbolicTraits symbolicTraits)
{
UIFontDescriptor *descriptor = font.fontDescriptor;
UIFontDescriptor *descriptorToUse = [descriptor fontDescriptorWithSymbolicTraits:symbolicTraits];
UIFont *newFont = [UIFont fontWithDescriptor:descriptorToUse size:font.pointSize];
return newFont;
}
@ZevEisenberg
ZevEisenberg / PrintAllCharacters.swift
Last active Oct 31, 2015
A script that prints all the Unicode characters. I would have uploaded the output as well, but it’s 50 MB and GitHub can’t handle my scale.
View PrintAllCharacters.swift
import Foundation
func describeCharsInRange(range: Range<Int>) -> String {
return range.map {
let swiftCharacter = Character(UnicodeScalar($0))
let string = String(swiftCharacter)
let hexString = NSString(format: "0x%.6X", $0) as String
// Optional in theory, but in this case it always returns a value
let name = string.stringByApplyingTransform(NSStringTransformToUnicodeName, reverse: false)!
@ZevEisenberg
ZevEisenberg / iOS 9 system font properties.json
Created Aug 13, 2015
Result of calling CTFontCopyFeatures on the system font in iOS 9 beta 5
View iOS 9 system font properties.json
[
{
"CTFeatureTypeIdentifier" : 0,
"CTFeatureTypeName" : "All Typographic Features",
"CTFeatureTypeNameID" : -100,
"CTFeatureTypeSelectors" : [
{
"CTFeatureSelectorDefault" : true,
"CTFeatureSelectorName" : "On",
"CTFeatureSelectorNameID" : -101,
@ZevEisenberg
ZevEisenberg / gist:d95cde83055f6c707050
Created Jul 10, 2015
Function to open the GitHub page of the current repo
View gist:d95cde83055f6c707050
function gh
{
local remoteURL=`git remote -v | grep fetch | awk -F ' ' '{print $2}'`
if [[ ! -z $remoteURL ]]; then
local isGitHubURL=`echo $remoteURL | grep -i github\.com`
if [[ ! -z $isGitHubURL ]]; then
local regex=".*github\.com[:/](.*)/(.*)\.git"
if [[ $remoteURL =~ $regex ]]; then
local owner=$match[1]
local repoName=$match[2]
You can’t perform that action at this time.