Skip to content

Instantly share code, notes, and snippets.

Port publishing:
There are 2 situations where this is useful:
1. Publish to parent (from in a macro)
2. Publish to root from deep in a nest of macros. This
gets painful fast if you have to publish from each layer.
Time:
QC has a really useful timebase system for any time-based
@interealtime
interealtime / gist:b97ced10eb7c74c0a66f
Created August 18, 2014 14:54
Local contrast filter
Take original image A, blur it to get image B. Then:
(A-B) * effectStrength + B
gives you output with lots more apparent detail.
It boosts contrast against surrounding pixels. A blur kernel with 1 pixel radius is equivalent to standard pixel sharpening, bigger blurs give a better effect but produce haloes around objects. You need a smarter blur that preserves edges to remove them.
@interealtime
interealtime / autolayout_issue
Last active August 29, 2015 14:04
Autolayout: modifying constraint multipliers / replacing IB constraints in code
If you set a constraint in Interface Builder and replace it in code for whatever reason (in my case I needed to change the multiplier to animate an aspect ratio), beware.
What happens: You replace that constraint, it works fine. Then the view rotates, and the hierarchy is re-computed. That constraint that you deleted and replaced in code? It gets added back. Now you have 2 conflicting constraints. Bad things happen.
What you should do: Delete that constraint in Interface Builder (or mark it as a placeholder / remove at build time), and create it from code when the view loads.