#Installing ngrok on OSX
- Download ngrok
- Unzip it to your Applications directory
- Create a symlink (instructions below)
Run the following two commands in Terminal to create the symlink.
# cd into your local bin directory| // | |
| // Screenshot.swift | |
| // | |
| // 1) Take a picture of a UIView | |
| // 2) Take a picture of a UIView's subframe. EG. Fullscreen UIView with a | |
| // small square box in the middle, it will only save what's visible in the box frame | |
| // but not the box itself | |
| import Foundation | |
| import UIKit |
| ######################### | |
| # .gitignore file for Xcode4 and Xcode5 Source projects | |
| # | |
| # Apple bugs, waiting for Apple to fix/respond: | |
| # | |
| # 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation? | |
| # | |
| # Version 2.6 | |
| # For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
| # |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
#Installing ngrok on OSX
Run the following two commands in Terminal to create the symlink.
# cd into your local bin directory| #Works with Xcode 9 (Confirmed) | |
| #1. Go to "Edit Schemes" | |
| #2. Go to "Build" | |
| #3. Go to "Pre-Actions" | |
| #4. Select YOUR app in "Provide Build Settings from:" | |
| #5. Paste Below Script in Box | |
| #6. Build Project | |
| #Build Number ++ |
| import Alamofire | |
| func makeGetCallWithAlamofire() { | |
| let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1" | |
| Alamofire.request(todoEndpoint) | |
| .responseJSON { response in | |
| // check for errors | |
| guard response.result.error == nil else { | |
| // got an error in getting the data, need to handle it | |
| print("error calling GET on /todos/1") |
Testing is helpful for ensuring that your code runs (driver code). This is to make sure that current features work, old features still work, and future work will be easily tested. By default, every Rails application has three environments: development, test, and production.
Rails offers three kinds of testing:
| // This extension is a port of @venj's solution from 2011 | |
| // https://github.com/venj/Cocoa-blog-code/blob/master/Round%20Corner%20Image/Round%20Corner%20Image/NSImage%2BRoundCorner.m | |
| extension NSImage { | |
| func roundCorners(withRadius radius: CGFloat) -> NSImage { | |
| let rect = NSRect(origin: NSPoint.zero, size: size) | |
| if | |
| let cgImage = self.cgImage, | |
| let context = CGContext(data: nil, |
| NSShadow *textShadow = [[NSShadow alloc] init]; | |
| textShadow.shadowColor = [UIColor darkGrayColor]; | |
| textShadow.shadowBlurRadius = 1.2; | |
| textShadow.shadowOffset = CGSizeMake(1,1); | |
| NSDictionary *attributes = @{NSForegroundColorAttributeName: [UIColor blackColor], | |
| NSShadowAttributeName: textShadow | |
| }; | |
| import Cocoa | |
| // https://github.com/DouglasHeriot/AutoGrowingNSTextField | |
| // for AutoLayout | |
| class AutoGrowingTextField: NSTextField { | |
| var minHeight: CGFloat? = 100 |