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
atom-text-editor.vim-mode.normal-mode, | |
atom-text-editor.vim-mode.operator-pending-mode, | |
atom-text-editor.vim-mode.visual-mode | |
{ | |
&, // only keep this if you want to see the cursor on non-focused tabs | |
&.is-focused { | |
&::shadow, // shadow-DOM enabled | |
& // shadow-DOM disabled | |
{ | |
/* cursor color */ |
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
# Convert the .cer file into a .pem file: | |
$ openssl x509 -in aps_development.cer -inform der -out PushChatCert.pem | |
# Convert the private key’s .p12 file into a .pem file: | |
$ openssl pkcs12 -nocerts -in PushChatKey.p12 -out PushChatKey.pem | |
# Finally, combine the certificate and key into a single .pem file | |
$ cat PushChatCert.pem PushChatKey.pem > ck.pem | |
# At this point it’s a good idea to test whether the certificate works. |
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 XCPlayground | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
typealias JSONDict = [String:AnyObject] | |
/* |
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 XCPlayground | |
func mask(viewToMask: UIView, maskRect: CGRect, invert: Bool = false) { | |
let maskLayer = CAShapeLayer() | |
let path = CGPathCreateMutable() | |
if (invert) { | |
CGPathAddRect(path, nil, viewToMask.bounds) |
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 | |
class WCCountingLabel: UILabel { | |
private var start: CGFloat = 0 | |
private var end: CGFloat = 0 | |
private var progress: NSTimeInterval = 0 | |
private var lastUpdate: NSTimeInterval = 0 | |
private var totalTime: NSTimeInterval = 0 | |
private var easingRate: CGFloat = 0 |
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 | |
//A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. | |
// | |
//For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps. | |
// | |
//Write a function: | |
// | |
//public func solution(N : Int) -> Int | |
//that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap. |
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 NSDate { | |
var relativeTime: String { | |
let calendar = NSCalendar.currentCalendar() | |
let components = calendar.components([.Second, .Minute, .Hour, .Day, .Month, .Year], fromDate: self, toDate: NSDate(), options: []) | |
if components.year > 0 { | |
if components.year < 2 { | |
return "Last year" | |
} else { |
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 | |
import PlaygroundSupport | |
class MyViewController: UIViewController { | |
let tableView: UITableView | |
init() { | |
tableView = UITableView() | |
super.init(nibName: nil, bundle: nil) |
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 | |
import PlaygroundSupport | |
class MyViewController: UIViewController { | |
let collectionView: UICollectionView | |
let flowLayout: UICollectionViewFlowLayout | |
init() { | |
flowLayout = UICollectionViewFlowLayout() |
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 PlaygroundSupport | |
class MyViewController: UIViewController { | |
let collectionView: UICollectionView | |
let flowLayout: UICollectionViewFlowLayout |
OlderNewer