Skip to content

Instantly share code, notes, and snippets.

View Jamonek's full-sized avatar
🏗️
Building.. Exploring.. Dreaming..

Jamone Kelly Jamonek

🏗️
Building.. Exploring.. Dreaming..
View GitHub Profile
// this goes into every page where the hijack will take place
// or where the hijack will land
function hijack (abs, landing) {
// get the #jump=url from the url
url_hash = window.location.hash.substr(1);
// make sure its actually a #jump=
if (url_hash.indexOf("jump=") !== -1) {
// trim off jump= and redirect
url = window.location.hash.substr(6);
window.setTimeout(function(){
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let popoverViewController = segue.destinationViewController as UIViewController
popoverViewController.modalPresentationStyle = UIModalPresentationStyle.Popover
popoverViewController.popoverPresentationController!.delegate = self
}
//
// LayersSubView.swift
// Veteran Care Network
//
// Created by Jamone Alexander Kelly on 3/4/15.
// Copyright (c) 2015 Veteran Care Network, LLC. All rights reserved.
//
import UIKit
//
// Legend.swift
// VCN
//
// Created by Jamone Alexander Kelly on 3/3/15.
// Copyright (c) 2015 Veteran Care Network, LLC. All rights reserved.
//
import UIKit
@Jamonek
Jamonek / MapVC.swift
Created March 24, 2015 01:56
Swift calling showRadiusKeyConstant before getCloseLocations()
dispatch_async(dispatch_get_main_queue()) {
if((self.defaults.valueForKey(self.facilityBoolKeyConstant) as Bool) != false) {
self.getCloseLocations("fc")
}
if((self.defaults.valueForKey(self.medicareBoolKeyConstant) as Bool) != false) {
self.getCloseLocations("md")
}
if((self.defaults.valueForKey(self.vaHospitalBoolKeyConstant) as Bool) != false) {
self.getCloseLocations("vh")
}
@Jamonek
Jamonek / chomp.swift
Created November 20, 2015 12:54
String extension to remove first character of a string in swift.
extension String {
var chomp : String {
mutating get {
self.removeAtIndex(self.startIndex)
return self
}
}
}
var test : String = "Chomp"
import UIKit
extension UIViewController {
func alert(title: String = "", message: String, actionTitle:String = "OK") {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)
let OKAction = UIAlertAction(title: actionTitle, style: .Default, handler: nil)
alertController.addAction(OKAction)
self.presentViewController(alertController, animated: true, completion: nil)
}
}
import UIKit
extension String {
func toAttributedString(font font:UIFont!, kerning: CGFloat!, color:UIColor!) -> NSAttributedString {
return NSAttributedString(string: self as String, font: font, kerning: kerning, color: color)!
}
}
// I know this is horrible lol I needed a quick hacky way to create the blurred view with data
// lil bit of number magic :o
// definitely a better way to do this lol I'll come back to it as well
schoolNameLabel.frame = CGRect(x: sX*0.22, y: sY * 0.1, width: 15, height: 20)
schoolNameLabel.sizeToFit()
schoolNameLabel.textColor = UIColor.grayColor()
specialView.addSubview(schoolNameLabel)
schoolNameLabelContent.frame = CGRect(x: sX*0.4, y: sY*0.1, width: 15, height: 20)
schoolNameLabelContent.sizeToFit()
// The fixed formula
struct Global {
static var schoolID: Int? // Work around for passing the selected location ID
static var userCoord: CLLocationCoordinate2D?
func computeDistance() -> Double {
// User coordinate
let uLat: Double = 35.6603676639829
let uLng: Double = -80.4443005566303
// School coordinate