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 SwiftUI | |
struct ItemView: View { | |
@ObservedObject var collection: ItemCollection | |
@ObservedObject var item: Item | |
var body: some View { | |
HStack(alignment: .firstTextBaseline) { | |
Text("Item: ") | |
Text(item.value) |
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 PlaygroundSupport | |
@objc class ViewExpander: NSObject { | |
var viewToChange: UIView | |
var heightConstraint: NSLayoutConstraint | |
init(viewToChange: UIView, heightConstraint: NSLayoutConstraint) { | |
self.viewToChange = viewToChange | |
self.heightConstraint = heightConstraint |
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 NSLayoutConstraint { | |
func withPriority(_ p: UILayoutPriority) -> Self { | |
self.priority = p | |
return self | |
} | |
} |
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 NSLayoutConstraint { | |
public class func visualConstraintsWithMetrics(metrics: [String : CGFloat], views: [String : UIView], options: NSLayoutFormatOptions = nil, strings: String...) -> [NSLayoutConstraint] { | |
return map(strings, { string in | |
return NSLayoutConstraint.constraintsWithVisualFormat(string, options: options, metrics: metrics, views: views) as [NSLayoutConstraint] | |
}).reduce([], +) | |
} | |
public class func visualConstraintsWithViews(views: [String : UIView], options: NSLayoutFormatOptions = nil, strings: String...) -> [NSLayoutConstraint] { | |
return map(strings, { string in |
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
UIFontTextStyleHeadline | |
font-family: ".HelveticaNeueInterface-MediumP4" | |
font-weight: bold | |
font-style: normal | |
font-size: 17.00pt | |
UIFontTextStyleBody | |
font-family: ".HelveticaNeueInterface-Regular" | |
font-weight: normal | |
font-style: normal | |
font-size: 17.00pt |
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
colorscheme railscasts | |
set number | |
if !exists('g:rails_projections') | |
let g:rails_projections = {} | |
endif | |
call extend(g:rails_projections, { | |
\ "app/domain/*.rb": { | |
\ "command": "domain", |
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
[branch] | |
autosetuprebase = always | |
[color] | |
ui = auto | |
[push] | |
default = tracking |
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
[alias] | |
st = status | |
ci = commit | |
co = checkout | |
cp = cherry-pick | |
put = push origin HEAD | |
fixup = !sh -c 'git commit -m \"fixup! $(git log -1 --format='\\''%s'\\'' $@)\"' - | |
squash = !sh -c 'git commit -m \"squash! $(git log -1 --format='\\''%s'\\'' $@)\"' - | |
ri = rebase --interactive | |
br = branch |
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
class ApplicationController < ActionController::Base | |
def self.present as, from, klass | |
if from.to_s.singularize == from.to_s | |
expose(as) { klass.new send(from) } | |
else | |
expose(as) { send(from).map { |orig| klass.new(orig) } } | |
end | |
end | |
end |
NewerOlder