Skip to content

Instantly share code, notes, and snippets.

Artem Sherbachuk artem-sherbachuk

Block or report user

Report or block artem-sherbachuk

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
artem-sherbachuk / MeasureCode.swift
Created Jan 19, 2017
measure code execution time with block.
View MeasureCode.swift
func measure(title: String, block: (() -> ()) -> ()) {
let startTime = CFAbsoluteTimeGetCurrent()
block {
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
println("\(title):: Time: \(timeElapsed)")
artem-sherbachuk / FadingInOutAVPlayer.swift
Created Jan 19, 2017
Fading audio in and out AVPlayer
View FadingInOutAVPlayer.swift
let player = AVPlayer()
func playFileAtURL(url: NSURL) {
let asset = AVAsset.assetWithURL(url) as AVAsset
let duration = asset.duration
let durationInSeconds = CMTimeGetSeconds(duration)
let item = AVPlayerItem(asset: asset)
let params = AVMutableAudioMixInputParameters(track: asset.tracks.first! as AVAssetTrack)
artem-sherbachuk /
Created Nov 15, 2016
Profiling compilation time of most expensivest func in swift
# Clean and build, capturing only lines containing `X.Yms` where X > 0, sorting from largest to smallest
xcodebuild -workspace App.xcworkspace -scheme App clean build | grep [1-9].[0-9]ms | sort -nr > culprits.txt
View Custom HTTP Headers with Swift 3.0 and Alamofire 4.0.swift
// MARK: - Adding a header to a single request
let headers: HTTPHeaders = [
"X-Mashape-Key": MY_API_KEY,
"Accept": "application/json"
Alamofire.request("", headers: headers)
.responseJSON { response in
You can’t perform that action at this time.