(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
func fuzzySearch(var originalString: String, var stringToSearch: String, caseSensitive: Bool = false)->Bool { | |
if countElements(originalString)==0 || countElements(stringToSearch)==0 { | |
return false | |
} | |
if countElements(originalString) < countElements(stringToSearch) { | |
return false | |
} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This is a quick tutorial explaining how to get a static website hosted on Heroku.
Why do this?
Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.
osascript -e 'tell application "iOS Simulator" to quit' | |
osascript -e 'tell application "Simulator" to quit' | |
xcrun simctl erase all |
// | |
// SimpleScrollingStack.swift | |
// A super-simple demo of a scrolling UIStackView in iOS 9 | |
// | |
// Created by Paul Hudson on 10/06/2015. | |
// Learn Swift at www.hackingwithswift.com | |
// @twostraws | |
// | |
import UIKit |
This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).
Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.
Switch to the master branch and make sure you are up to date:
// derived from https://www.veasoftware.com/posts/uipageviewcontroller-in-swift-xcode-62-ios-82-tutorial | |
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
window!.rootViewController = ViewController() |
lazy var v1:UIView = { | |
let v = UIView() | |
v.backgroundColor = .blueColor() | |
return v | |
}() | |
lazy var v2:UIView = { | |
let v = UIView() | |
v.backgroundColor = .blueColor() | |
return v |
import Foundation | |
import UIKit | |
extension UIBezierPath { | |
public static func withArrowFromPoint(startPoint:CGPoint, | |
endPoint:CGPoint, | |
tailWidth:CGFloat, | |
headWidth:CGFloat, | |
headLength:CGFloat) -> UIBezierPath { |
extension UIImageView { | |
/// Loads image from web asynchronosly and caches it, in case you have to load url | |
/// again, it will be loaded from cache if available | |
func load(url: URL, placeholder: UIImage?, cache: URLCache? = nil) { | |
let cache = cache ?? URLCache.shared | |
let request = URLRequest(url: url) | |
if let data = cache.cachedResponse(for: request)?.data, let image = UIImage(data: data) { | |
self.image = image | |
} else { | |
self.image = placeholder |