This gist is a practice exercise TDDing a solution to a coding interview question on CoderPad. I used this as a template.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DISCLAIMER: THE BELOW IS LESS-THAN-TERRIFIC RUBY. IT IS JUST SOMETHING I WHIPPED UP QUICKLY. | |
# This is a script for iterating over, in order of oldest to newest, all | |
# commits in all GitHub pull requests that were merged into a particular | |
# branch, and cherry-picking them onto the currently checked-out branch. | |
# It's useful for creating a copy of, say, a feature branch that was branched | |
# off a branch you did not want it to be, but that feature branch is too | |
# complex to simply rebase elsewhere. | |
# | |
# Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'Slop' | |
require 'Xcodeproj' | |
DEFAULT_PROJECT_FILE = 'Foo/Bar.xcodeproj' | |
opts = Slop.parse do |o| | |
o.string '-t', '--target', 'the name of the test target from which you want to remove all other spec files' | |
o.array '-k', '--keep', 'either a single file, or a comma-separated list of files that you want to keep in the test target; all other files matching /Spec.m$/ will be removed; note that you can submit --keep a.m --keep b.m, if you don\'t want to use a comma-separated list', delimiter: ',' | |
o.string '-p', '--project', "the project file containing the test target you want to modify; default is #{DEFAULT_PROJECT_FILE}", default: DEFAULT_PROJECT_FILE | |
o.on '-h', '--help', 'print this help message' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/Library/Developer/CoreSimulator/Devices | |
# get a unique list of all the PList files below this directory | |
find . -name '*.plist' -exec basename {} \; | sort -u | |
# get a list of all xyz PList files | |
find . -name '*.plist' -exec basename {} \; | grep -i xyz | |
# find all those com.xyz.plist files below the current directory | |
find . -name com.xyz.plist -ls |