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
import XCTest | |
extension Decodable { | |
init(_ json: String) throws { | |
self = try JSONDecoder().decode(Self.self, from: json.data(using: .utf8)!) | |
} | |
} | |
final class DecodableExtensions: XCTestCase { |
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
extension UIView { | |
/// Example: call someView.nudge(0, 30) | |
func nudge(_ dx: CGFloat, _ dy: CGFloat) { | |
self.frame = self.frame.offsetBy(dx: dx, dy: dy) | |
CATransaction.flush() | |
} | |
} | |
extension UIView { | |
/// Example: po UIView.root |
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
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
let window = UIWindow(frame: UIScreen.main.bounds) |
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
# Calling functions | |
expression CATransaction.flush() | |
call CATransaction.flush() | |
# Assigning variables | |
expression didLoad = true | |
command alias assign expression -- | |
assign didLoad = true | |
# Symbolic breakpoints |
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
// Swift: Syntax Cheat Codes | |
// ↑ ↑ ↓ ↓ ← → ← → B A | |
// | |
// Author: Andyy Hope | |
// Twitter: @andyyhope | |
// Medium: medium.com/@andyyhope | |
import UIKit |
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
import UIKit | |
import Darwin | |
@IBDesignable | |
class DTWheelChart: UIView { | |
@IBInspectable var days: Int = 28 | |
var shapeLayers : [CAShapeLayer]! | |
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
#!/usr/bin/env ruby | |
remote_url = `git config --get remote.origin.url`.strip | |
matches = remote_url.match(/github\.com:(.+)\/(.+)\.git/) | |
if matches | |
branch_name = `git rev-parse --abbrev-ref HEAD`.strip | |
exec "open https://github.com/#{matches[1]}/#{matches[2]}/compare/#{branch_name}?expand=1" | |
end | |
# Save this file as ~/bin/git-pr and then `chmod +x ~/bin/git-pr`. |
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
1) Create a script named '~/bin/xscope': | |
#!/bin/sh | |
parameter="" | |
if [ -z "$1" ]; then | |
parameter=`cat /dev/stdin` | |
else | |
parameter="$1" | |
fi |
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
""" File: reveal.py | |
Add to ~/.lldbinit: | |
command script import ~/.lldb-scripts/reveal.py | |
Q: Want to automatically load the Reveal lib on launch while debugging from Xcode? | |
A: In Xcode: | |
Add a Symbolic Breakpoint | |
Symbol: "UIApplicationMain" | |
Action: Debugger Command with value "reveal" |
NewerOlder