This file contains hidden or 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
| // | |
| // ABLLinkManager.swift | |
| // | |
| // Created by Cem Olcay on 5.03.2018. | |
| // Copyright © 2018 cemolcay. All rights reserved. | |
| // | |
| import Foundation | |
| import AVFoundation |
This file contains hidden or 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
| func convertValue(oldValue: CGFloat, oldMin: CGFloat, oldMax: CGFloat, newMin: CGFloat, newMax: CGFloat) -> CGFloat { | |
| let oldRange = oldMax - oldMin | |
| let newRange = newMax - newMin | |
| return (((oldValue - oldMin) * newRange) / oldRange) + newMin | |
| } |
This file contains hidden or 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
| extension Array { | |
| subscript(circular index: Int) -> Element? { | |
| var i = index | |
| if i < 0 || isEmpty { | |
| return nil | |
| } else if i > count - 1 { | |
| i = index % count | |
| } | |
| return self[i] | |
| } |
This file contains hidden or 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
| import Foundation | |
| var input = [[Int]]() | |
| while let line = readLine() { | |
| input.append(line.components(separatedBy: [" "]).map { Int($0)! }) | |
| } | |
| print(input) |
This file contains hidden or 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
| # git-tag-move.sh | |
| TAG = $1 | |
| COMMIT = $2 | |
| git tag --force TAG COMMIT | |
| git push --force --tags |
This file contains hidden or 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
| PORT=$1 | |
| PIDS=$(lsof -t -i:$PORT) | |
| for i in ${PIDS[@]} | |
| do | |
| kill -9 $i | |
| echo "PID $i on port $PORT killed" | |
| done |
This file contains hidden or 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
| from __future__ import absolute_import, division, print_function | |
| import tensorflow as tf | |
| import tflearn | |
| import os | |
| os.environ['TF_CPP_MIN_LOG_LEVEL']='2' | |
| # Logical NOT operator | |
| X = [[0.], [1.]] |
This file contains hidden or 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
| public struct NSRectCorner: OptionSet { | |
| public let rawValue: UInt | |
| public static let none = NSRectCorner(rawValue: 0) | |
| public static let topLeft = NSRectCorner(rawValue: 1 << 0) | |
| public static let topRight = NSRectCorner(rawValue: 1 << 1) | |
| public static let bottomLeft = NSRectCorner(rawValue: 1 << 2) | |
| public static let bottomRight = NSRectCorner(rawValue: 1 << 3) | |
| public static var all: NSRectCorner { | |
| return [.topLeft, .topRight, .bottomLeft, .bottomRight] |
This file contains hidden or 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
| import UIKit | |
| // swift port of stackoverflow answer | |
| // http://stackoverflow.com/a/31301238/2048130 | |
| extension CGFloat { | |
| /** Degrees to Radian **/ | |
| var degrees: CGFloat { | |
| return self * (180.0 / .pi) | |
| } |
This file contains hidden or 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
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| import SpriteKit | |
| import GameplayKit | |
| enum NoiseTileType: CustomStringConvertible { | |
| case ocean | |
| case grass | |
| case mountain |