Skip to content

Instantly share code, notes, and snippets.

View Pasanpr's full-sized avatar

Pasan Premaratne Pasanpr

View GitHub Profile
import UIKit
let json = """
{
"kind": "Listing",
"data": {
"modhash": "asjdfhhjsdfkjhsdfksjd23423",
"dist": 25,
"children": [
{

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@Pasanpr
Pasanpr / TextSize.swift
Created May 9, 2017 02:30 — forked from gnou/TextSize.swift
Calculate height of some text when width is fixed
public struct TextSize {
fileprivate struct CacheEntry: Hashable {
let text: String
let font: UIFont
let width: CGFloat
let insets: UIEdgeInsets
fileprivate var hashValue: Int {
return text.hashValue ^ Int(width) ^ Int(insets.top) ^ Int(insets.left) ^ Int(insets.bottom) ^ Int(insets.right)
@Pasanpr
Pasanpr / blogs.txt
Created July 25, 2016 14:57
Blogs!
Bryan Irace: http://irace.me/
Chris Eidhof: http://chris.eidhof.nl/
Objc.io: https://www.objc.io/
Airspeed Velocity: https://airspeedvelocity.net/
Cocoa With Love: http://www.cocoawithlove.com/
Ash Furrow: https://ashfurrow.com/
Jessie Squires: http://www.jessesquires.com/
Soroush Khanlou: http://khanlou.com/
Ole Begemann: http://oleb.net/
Krzysztof Zabłocki: http://merowing.info/
@Pasanpr
Pasanpr / Error.txt
Created June 13, 2015 17:03
Xcode build error
CompileSwift normal x86_64 /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/LoginViewController.swift
cd /Users/pasan/iOS/Swift/Projects/BookShelf
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/LoginViewController.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/NSData+OAuthSwift.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/GoodreadsCredential.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/AppDelegate.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/OAuth1Swift.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/SHA1.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/Shelf.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/NetworkDownController.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/String+OAuthSwift.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/HomeViewController
@Pasanpr
Pasanpr / CoreDataStack
Created June 8, 2014 18:01
Moving CoreData code to separate Swift file
//
// CoreDataStack.swift
// CoreDataStack
//
// Created by Pasan Premaratne on 6/8/14.
// Copyright (c) 2014 Pasan Premaratne. All rights reserved.
//
import CoreData
import Foundation