A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$ if your browser aliases it:
~ 108 byte version
| var initalArray = [1, 2, 3] | |
| let pointer: UnsafeMutablePointer<Int> = UnsafeMutablePointer(initalArray) | |
| let arrary = Array(UnsafeBufferPointer(start: pointer, count: initalArray.count)) |
| // This ensures that the automaticallyAdjustsScrollViewInsets magic works | |
| // On our newly added view controller as well. | |
| // This triggers _layoutViewController which then triggers | |
| // _computeAndApplyScrollContentInsetDeltaForViewController: | |
| // which finally updates our content inset of the scroll view (if any) | |
| // rdar://19053416 | |
| [self.navigationController.view setNeedsLayout]; |
| // | |
| // LinkedTextView.h | |
| // | |
| // Created by Benjamin Bojko on 10/22/14. | |
| // | |
| // The MIT License (MIT) | |
| // | |
| // Copyright (c) 2014 Benjamin Bojko | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy |
| import Foundation | |
| /// An abstract class that makes building simple asynchronous operations easy. | |
| /// Subclasses must implement `execute()` to perform any work and call | |
| /// `finish()` when they are done. All `NSOperation` work will be handled | |
| /// automatically. | |
| open class AsynchronousOperation: Operation { | |
| // MARK: - Properties |
(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.
| @implementation UIImage (scale) | |
| /** | |
| * Scales an image to fit within a bounds with a size governed by | |
| * the passed size. Also keeps the aspect ratio. | |
| * | |
| * Switch MIN to MAX for aspect fill instead of fit. | |
| * | |
| * @param newSize the size of the bounds the image must fit within. | |
| * @return a new scaled image. |
| // | |
| // CommonMacros.h | |
| // Created by Tom Adriaenssen (@inferis) | |
| // Inspired by the awesome work by Piet Jaspers (@pjaspers) | |
| // | |
| /* | |
| * How to use this file: | |
| * 1. Find your .pch file | |
| * 2. Import this file |