Play a sine wave.
import AudioKit
let osc = AKOscillator()
osc.frequency = 440.0
osc.start()
AudioKit.output = osc
AudioKit.start()| import Foundation | |
| struct MinHeap { | |
| var items: [Int] = [] | |
| //Get Index | |
| private func getLeftChildIndex(_ parentIndex: Int) -> Int { | |
| return 2 * parentIndex + 1 | |
| } | |
| private func getRightChildIndex(_ parentIndex: Int) -> Int { |
Play a sine wave.
import AudioKit
let osc = AKOscillator()
osc.frequency = 440.0
osc.start()
AudioKit.output = osc
AudioKit.start()| import UIKit | |
| extension UIImage { | |
| convenience init?(color: UIColor, size: CGSize = CGSize(width: 1.0, height: 1.0)) { | |
| let image = UIGraphicsImageRenderer(size: size).image { context in | |
| color.setFill() | |
| context.fill(CGRect(origin: .zero, size: size)) | |
| } | |
| // | |
| // Diffable.swift | |
| // | |
| // Created by danielgalasko on 8/5/17. | |
| // | |
| import Foundation | |
| import IGListKit |
| import Foundation | |
| extension String { | |
| func snakecased() -> String { | |
| return self.replacingOccurrences(of: "(?<=[^A-Z])([A-Z])", with: "_$0", options: .regularExpression).lowercased() | |
| } | |
| } |
| // MARK: - Adding a header to a single request | |
| func doRequestWithHeaders1() { | |
| let headers: HTTPHeaders = [ | |
| "X-Mashape-Key": MY_API_KEY, | |
| "Accept": "application/json" | |
| ] | |
| Alamofire.request("https://mashape-community-urban-dictionary.p.mashape.com/define?term=smh", headers: headers) | |
| .responseJSON { response in | |
| debugPrint(response) |
| # Created by https://www.gitignore.io/api/webstorm | |
| ### WebStorm ### | |
| # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | |
| # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | |
| # User-specific stuff: | |
| .idea |