Skip to content

Instantly share code, notes, and snippets.

View naturaln0va's full-sized avatar
🌯
Wants a burrito

Ryan Ackermann naturaln0va

🌯
Wants a burrito
View GitHub Profile
@naturaln0va
naturaln0va / Image by Capturing
Created July 7, 2015 20:34
Get a UIImage of the contents of a UIView
extension UIView
{
func imageByCapturing() -> UIImage
{
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0)
self.drawViewHierarchyInRect(self.frame, afterScreenUpdates: true)
let image = UIGraphicsGetImageFromCurrentImageContext()
@naturaln0va
naturaln0va / UIColorHexValue
Created July 13, 2015 21:42
UIColor hex value extension in Swift.
import UIKit
extension UIColor
{
func hexString() -> String?
{
var redValue: CGFloat = 0
var greenValue: CGFloat = 0
var blueValue: CGFloat = 0
var alphaValue: CGFloat = 0
@naturaln0va
naturaln0va / LocationVCard.swift
Created February 4, 2016 19:32
Create a location vCard for use in UIActivityViewController like in Apple's Maps app.
import CoreLocation
func locationVCardURLFromCoordinate(coordinate: CLLocationCoordinate2D) -> NSURL?
{
guard let cachesPathString = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true).first else {
print("Error: couldn't find the caches directory.")
return nil
}
@naturaln0va
naturaln0va / keybase.md
Created October 5, 2017 11:39
My keybase verification

Keybase proof

I hereby claim:

  • I am naturaln0va on github.
  • I am naturaln0va (https://keybase.io/naturaln0va) on keybase.
  • I have a public key ASCs6I_MuMzLgV4Q1IGCeIVD1dqYmhRAA6pnK_4ewQ2T_Ao

To claim this, I am signing this object: