This file contains 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
// | |
// Regex.swift | |
// | |
extension String { | |
public var byStrippingFormatCharacters: String { | |
var result = self | |
// #H1, #H2 | |
Regex.headerRegex.matches(in: result, options: [], range: NSMakeRange(0, result.count)).forEach { |
This file contains 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
func collectionView(collectionView: NSCollectionView, draggingSession session: NSDraggingSession, willBeginAtPoint screenPoint: NSPoint, forItemsAtIndexPaths indexPaths: Set<NSIndexPath>) { | |
if let indexPath = draggingIndexPaths.first, | |
item = collectionView.itemAtIndexPath(indexPath) { | |
draggingItem = item // draggingItem is temporary instance variable of NSCollectionViewItem | |
} | |
} | |
func collectionView(collectionView: NSCollectionView, draggingSession session: NSDraggingSession, endedAtPoint screenPoint: NSPoint, dragOperation operation: NSDragOperation) { | |
draggingItem = nil |
This file contains 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
func animateView() { | |
CATransaction.begin() | |
CATransaction.setCompletionBlock { [unowned self] in | |
self.removeFromSuperview() | |
} | |
let rotationAtStart = view.layer?.valueForKeyPath("transform.rotation.x") as? NSNumber | |
let rotate = CABasicAnimation(keyPath: "transform.rotation.x") | |
rotate.duration = 0.3 |
This file contains 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
#if os(iOS) | |
import Cocoa | |
public struct HNColor { | |
public static var DarkGray: UIColor = UIColor(white: 36/255, alpha: 1) | |
public static var DeepGray: UIColor = UIColor(white: 27/255, alpha: 1) | |
} | |
#endif |
This file contains 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
#if os(OSX) | |
import Cocoa | |
#endif | |
#if os(iOS) | |
import UIKit | |
#endif |
This file contains 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
# Uncomment this line to define a global platform for your project | |
platform :osx, '10.11' | |
use_frameworks! | |
target 'AppName' do | |
end | |
target 'AppNameTests' do | |
This file contains 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
// | |
// ShiftClickGestureRecognizer.swift | |
// | |
// Created by Harry Ng on 27/1/2016. | |
// Copyright © 2016 STAY REAL. All rights reserved. | |
// | |
import Cocoa | |
class ShiftClickGestureRecognizer: NSClickGestureRecognizer { |
[69,81,30,38,9,2,47,61,32,79]
- Selection Sort Wiki
- Insertion Sort Wiki
NewerOlder