Tech

Opening Pull Requests from terminal

5 min read

I recently started using Tower, which, sadly, doesn't support opening Pull Requests. Since I was used to this after using GitUp and SourceTree, I now found the process of opening Pull Requests quite cumbersome. Here's my take on it, by making use of GitHub's hub gem and a bit of .bash_profile tinkering:

# This will return a string with your current branch name.
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
Continue reading →

Safari's new pinned tab feature

A really interesting thing I noticed is that if you open a link inside a pinned tab, it will open a new one, with an active back button, which if pressed, will close the newly created tab and focusing the parent pinned tab again.

I haven't found a way to disable this behavior, but I personally like it.

Xcode 7 crash analysis tools

45 sec read

I saw this gem the other day and I think it's awesome!

One of the only downsides is that you can't import crash logs, but you can (kinda) export the existing ones, if you want to see them in Hockey's Crash Browser, for example: Right click on a crash → Show in Finder → right click on the file (should be an xccrashpoint file) → Show Package Contents → DistributionInfosallLogs → here you can find all the crash logs related to that specific crash (apparently several are grouped into a crash-group).

Searchable WWDC videos

25 sec read

You can now search for keywords within WWDC videos.

Now it's easier to discover and share information presented in WWDC videos with our recent search update. You can search a keyword and find all the instances of it mentioned in the videos. Go straight to the time the keyword was mentioned in the video or easily share a link to it. Try it out.

UIScrollViews and auto layout

4 min read

UIScrollViews are a different kind of beast when created with auto layout, but the basic idea is to constrain it to a fixed frame, and let the constraints of its subviews determine its contentSize. So let's start with that:

private lazy var scrollView: UIScrollView = {
  let sv = UIScrollView(frame: CGRect.zero)
  self.view.addSubview(sv)
  
  sv.translatesAutoresizingMaskIntoConstraints = false
  sv.alignTop("0", leading: "0", bottom: "0", trailing: "0", toView: self.view)
  
  return sv
}()

We have a scrollView that is the same size of our view, nothing fancy.

Continue reading →

Content blockers and assets

If you're using any kind of offsite assets, like webfonts or Font Awesome icons, take into consideration that these will be blocked by iOS 9's content blockers - either bring them locally on your server, either have fallbacks; I chose the former, which also improved the pages' loading times.

DHL Express

1 min read

I recently bought a couple of cases for the Apple Watch and I had the option to ship via USPS or DHL, and since DHL was only $10 more expensive, I thought sure, it's worth it.

Sorry for the rant post, but I'm really, really disappointed. Long story short, if there are other options, I doubt I will choose DHL again - I had a terrible customer service experience.

The problems started with the fact that I wasn't announced when the package arrived at the customs and couldn't be moved further because they need extra info - I had to call them for 3 days in a row, and to drive to one of their offices to get the needed info.

Continue reading →

Changing (just) the font size of a button

45 sec read

We have in the app a generic button, styled to look the same across the app - from shadows to title. Some places require a smaller font though, and I didn't really want to duplicate code, so something had to be done. Here's my little trick for it:

// titleLabel is nil only for system buttons, as per documentation
button.titleLabel!.font = UIFont(
  name: button.titleLabel!.font.fontName,
  size: button.titleLabel!.font.pointSize - 2
)

Auto Layout and transitionWithView

1 min read

If you want to animate the hidden property of a view, or animate the title of a button, the solution is simple - use UIView.transitionWithView(button [...]. If you want to animate the title of several buttons, the solution is just as simple - use UIView.transitionWithView(containerView [...].

The problem arises when you want to animate constraint changes at the same time: they won't be animated anymore, no matter if you encapsulate them in the same transitionWithView call, a new one, or inside an animateWithDuration call.

Continue reading →

Diving into Auto Layout

This is one of the best articles I read about Auto Layout, and one of the best articles about a given topic, altogether. I really, really enjoyed reading it.