Skip to content

Instantly share code, notes, and snippets.

View PaulTaykalo's full-sized avatar

Paul Taykalo PaulTaykalo

View GitHub Profile
@PaulTaykalo
PaulTaykalo / MinMax.swift
Created September 20, 2018 14:27
MinMax.swift
extension Sequence {
@warn_unqualified_access
public func min<T:Comparable>(by: (Element) throws -> T) rethrows -> Element? {
return try self.min { try by($0) < by($1) }
}
@warn_unqualified_access
public func max<T:Comparable>(by: (Element) throws -> T) rethrows -> Element? {
return try self.max { try by($0) > by($1) }
}
}
@ddunbar
ddunbar / xcbuild-debugging-tricks.md
Last active April 13, 2024 15:41
Xcode new build system debugging tricks

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
//
// InAppManager.swift
//
// Created by Ellina Kuznetcova on 12/10/2016.
// Copyright © 2016 Flatstack. All rights reserved.
//
import Foundation
import StoreKit
@xNekOIx
xNekOIx / DotsActivity.m
Created July 31, 2015 15:39
Dots activity indicator
RACSignal* activitySignal = [[RACObserve(self, viewModel.inProgress) map:^id(NSNumber* value) {
if (value.boolValue == NO) return [RACSignal return:@""];
return [[RACSignal interval:0.5 onScheduler:[RACScheduler mainThreadScheduler]]
scanWithStart:@"."
reduce:^id(NSString* previous, id current) {
if (previous.length > 2) return @".";
return [previous stringByAppendingString:@"."];
}];
}] switchToLatest];
@AlexDenisov
AlexDenisov / spec_arc_support.rb
Created March 27, 2013 14:51
Add compiler flags on each Spec in target
require 'xcodeproj'
project = Xcodeproj::Project.new 'SomeProject.xcodeproj'
target = project.targets.last
build_phase = target.source_build_phase
files = build_phase.files
settings = { 'COMPILER_FLAGS' => '-fno-objc-arc' }
files.each do |f|
if f.display_name =~ /Spec/
if f.settings
@pilky
pilky / ShowDerivedData.rb
Created November 5, 2011 14:24
A script for showing the derived data folder for an Xcode workspace. Intended to be invoked from a custom behaviour
#!/usr/bin/env ruby
#This script currently only works if you have your derived data in the default location
#First look for a project path as our workspace
xcodeWorkspacePath = ENV['XcodeProjectPath']
if xcodeWorkspacePath
workspaceName = /([\w\s]+).xcodeproj/.match(xcodeWorkspacePath)[1]
#If we don't have a project we have a workspace, check for that and exit with code 1 if that doesn't exist
else