Skip to content

Instantly share code, notes, and snippets.

View artemch's full-sized avatar

Artem Chabannyi artemch

View GitHub Profile
@artemch
artemch / xcode-12-simulator-issue-fix.txt
Last active September 21, 2020 14:06
Cocoapods libs - xcode 12 and xcode 11
Fix xcode 12 simulator issue. Based on https://stackoverflow.com/a/63955114
Warning: active Xcode and active command line tools must match (xcode->prerefernce->locations->command line tools):
Xcode 12 - command line tools 12
Xcode 11 - command line tools 11
Add to Podfile next code (where xcodeCLTVersion - https://gist.github.com/artemch/8807c55bb3401d353aaeaeebf28b5415). Then call pod install:
# add at the top of Podfile
require "./path_to_file/xcodeCLTVersion"
@artemch
artemch / xcodeCLTVersion.rb
Created September 21, 2020 13:23
Active Xcode command line tools version
def xcodeCLTVersion
IO.popen("xcodebuild -version") do |io|
version = io.readline.split(" ").last.to_f
end
end
@artemch
artemch / strip-frameworks.sh
Last active September 25, 2020 05:37
iOS framework binaries must be stripped off back from simulator slices. This is copy of [strip-frameworks.sh](https://github.com/realm/realm-cocoa/blob/d59c86f11525f346c8e8db277fdbf2d9ff990d98/scripts/strip-frameworks.sh)
################################################################################
#
# Copyright 2015 Realm Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
Pod::Spec.new do |s|
s.name = "Focus"
s.version = "0.3.1"
s.license = "MIT"
s.summary = "Focus is an Optics library for Swift (where Optics includes Lens, Prisms, and Isos) that is inspired by Haskell's Lens library."
s.homepage = "https://github.com/typelift/Focus"
s.source = { :git => 'https://github.com/typelift/Focus.git',
:tag => "#{s.version}", :submodules => true
}
s.author = { "" => "" }
//
// Signal+Extensions.swift
// Khan Academy
//
// Created by Nacho Soto on 10/1/15.
// Copyright © 2015 Khan Academy. All rights reserved.
//
import ReactiveCocoa
-(NSString *)shortNumberFromLarge:(NSNumber*)number {
if (!number) {
return nil;
}
long long num = [number longLongValue];
int s = ( (num < 0) ? -1 : (num > 0) ? 1 : 0 );
NSString *sign = (s == -1 ? @"-" : @"" );
@artemch
artemch / sound converter to caf
Created March 17, 2014 09:08
Put this script in folder with sound files and run script in terminal. Required Xcode command line tools.
path = Dir.getwd
extensions = ['.m4a','.mp3','.wav']
Dir.foreach(path) do |item|
next if item == '.' or item == '..'
if extensions.include? File.extname(item)
string = 'afconvert -f caff -d ima4 ' + item
output = system(string)
puts "output is #{output}"
end
end