Skip to content

Instantly share code, notes, and snippets.

@gkye
gkye / UIImage+PixelColor.swift
Created August 20, 2016 23:42 — forked from marchinram/UIImage+PixelColor.swift
iOS Swift UIImage subscript extension to get pixel color
import UIKit
extension UIImage {
subscript (x: Int, y: Int) -> UIColor? {
if x < 0 || x > Int(size.width) || y < 0 || y > Int(size.height) {
return nil
}
let darkNavy = UIColor(red:0.07, green:0.09, blue:0.18, alpha:1.0)
let lightBlue = UIColor(red:0.22, green:0.52, blue:0.84, alpha:1.0)
let oceanGreen = UIColor(red:0.22, green:0.52, blue:0.84, alpha:1.0)
let lightningYellow = UIColor(red:0.98, green:0.71, blue:0.16, alpha:1.0)
let greyBlue =UIColor(red:0.55, green:0.56, blue:0.63, alpha:1.0)
let geenishGrey = UIColor(red:0.80, green:0.85, blue:0.75, alpha:1.0)
let lighterBlue = UIColor(red:0.53, green:0.67, blue:0.86, alpha:1.0)
let mustardYellow = UIColor(red:0.83, green:0.63, blue:0.23, alpha:1.0)
private let kTableHeaderHeight: CGFloat = 300
var headerView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
headerView = tableView.tableHeaderView
tableView.tableHeaderView = nil
tableView.addSubview(headerView)
//Move Object
public float moveSpeed;
// Use this for initialization
void Start () {
moveSpeed = 1f;
}
// Update is called once per frame
void Update () {
import Foundation
import UIKit
class ScrollingImageCell: UICollectionViewCell {
var imageView: UIImageView!
var scrollView: UIScrollView!
var doubleTapGesture: UITapGestureRecognizer!
var image: UIImage? {
didSet{
@gkye
gkye / HKQuantityTypeIdentifiers.swift
Created February 4, 2018 08:02
HKTypeIdentifiers for HealthKit
//
// HKTypeIdentifiers
// HealthKit
//
// Copyright (c) 2014 Apple Inc. All rights reserved.
//
/*--------------------------------*/
/* HKQuantityType Identifiers */
@gkye
gkye / SwiftyProgressHUD.swift
Created May 4, 2018 01:00 — forked from mspvirajpatel/SwiftyProgressHUD.swift
SwiftyProgressHUD is a Swift based clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS
//
// SwiftyProgressHUD.swift
// mWELL
//
// Created by Shubham Naik on 11/07/17.
// Copyright © 2017 Shubham. All rights reserved.
//
import UIKit
class SwiftyProgressHUD: UIView {
@gkye
gkye / copy_appropriate_google-service-info-plist.sh
Created June 10, 2019 16:43 — forked from tylermilner/copy_appropriate_google-service-info-plist.sh
A shell script to selectively copy your GoogleService-Info.plist into your app bundle based on the current build configuration. (Dev, Staging & Production)
# Name of the resource we're selectively copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
# Get references to dev and prod versions of the GoogleService-Info.plist
# NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually)
GOOGLESERVICE_INFO_DEV=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Dev/${GOOGLESERVICE_INFO_PLIST}
extension XCTestCase {
func asyncExpectation(description: String, timeout: TimeInterval = 10, completion: (XCTestExpectation) -> ()) {
let promise = expectation(description: description)
completion(promise)
waitForExpectations(timeout: timeout, handler: nil)
}
}
[
{
"num_subscribers":8989,
"tagline":"Fast Company inspires a new breed of innovative and creative thought leaders who are actively inventing the future of business.",
"value":"http://feeds.feedburner.com/fastcompany/headlines",
"label":"Fast Company",
"score":8989.0,
"link":"https://www.fastcompany.com",
"raw_score":9.396447,
"id":1264