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 / fixXcode.sh
Last active Dec 14, 2015
Function to fix Xcode’s code snippets library by replacing it with the one from the ZevEisenberg/ios-convenience git repo
View fixXcode.sh
function fixXcode
{
pushd > /dev/null
cd
xcodepath=`xcode-select --print-path`/..
destination=$xcodepath/Frameworks/IDEKit.framework/Versions/A/Resources/SystemCodeSnippets.codesnippets
shouldRelaunchXcode=false
if [[ `osascript -e 'tell app "System Events" to count processes whose name is "Xcode"'` == 1 ]]; then
@ZevEisenberg
ZevEisenberg / glastcommit.sh
Last active Dec 24, 2015
Copies full log of the last git commit to the clipboard (and displays it, too)
View glastcommit.sh
# this is useful for lots of git-related functions
alias returnIfNotGitRepo='if isGitRepo; then; ; else echo "No repositories here."; return 1; fi'
function glastcommit
{
returnIfNotGitRepo
git show --name-only
git show --name-only | pbcopy
}
@ZevEisenberg
ZevEisenberg / fixTerminal.sh
Created Jan 20, 2014
Function to set Control-Tab and Control-Shift-Tab for Select Next Tab and Select Previous Tab in Terminal.app
View fixTerminal.sh
#!/bin/sh
# First, a function to safely add custom menu item entries to com.apple.universalaccess.plist,
# since duplicate entries in com.apple.custommenu.apps causes a crash when you open
# System Preferences and go to Keyboard -> Shortcusts
function addCustomMenuEntryIfNeeded
{
if [[ $# == 0 || $# > 1 ]]; then
echo "usage: addCustomMenuEntryIfNeeded com.company.appname"
return 1
@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 / keyboardShortcuts.sh
Last active Jun 30, 2017
Keyboard Shortcut Shell Script Magic
View keyboardShortcuts.sh
function addCustomMenuEntryIfNeeded
{
if [[ $# == 0 || $# > 1 ]]; then
echo "usage: addCustomMenuEntryIfNeeded com.company.appname"
return 1
else
local contents=`defaults read com.apple.universalaccess "com.apple.custommenu.apps"`
local grepResults=`echo $contents | grep $1`
if [[ -z $grepResults ]]; then
# does not contain app
@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 / 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 / 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 / Find Siteswap Loops.swift
Created Dec 4, 2017
Find how long it takes for an async siteswap to loop
View Find Siteswap Loops.swift
//
// main.swift
// Swapper
//
// Created by Zev Eisenberg on 12/4/17.
// Copyright © 2017 Zev Eisenberg. All rights reserved.
//
// Code ported from https://www.reddit.com/r/juggling/comments/7839h0/find_number_of_beats_to_loop_a_given_siteswap/douuezu/
// It finds how many beats you would have to juggle an async siteswap pattern before
View SectionedArray.swift
struct SectionedArray<GroupKey, Item> where GroupKey: Comparable & Hashable {
struct Section {
let key: GroupKey
var items: [Item]
}
var sections: [Section]
var count: Int {
You can’t perform that action at this time.