Skip to content

Instantly share code, notes, and snippets.

View caughtinflux's full-sized avatar

Aditya Krishnadevan caughtinflux

View GitHub Profile

Keybase proof

I hereby claim:

  • I am caughtinflux on github.
  • I am caughtinflux (https://keybase.io/caughtinflux) on keybase.
  • I have a public key ASB9As4X5W2cHO81SgkqF95yRHo6_22ePHGb6UZhg-WOpwo

To claim this, I am signing this object:

➜ Vivify git:(kb_recents) pilot upload
[15:06:31]: Login to iTunes Connect (aditya@giffage.com)
/Library/Ruby/Gems/2.0.0/gems/spaceship-0.14.0/lib/spaceship/tunes/tunes_client.rb:98:in `send_login_request': (Spaceship::TunesClient::ITunesConnectError)
@caughtinflux
caughtinflux / ctrlpt.m
Last active January 17, 2016 17:13
Quadratic Bezier Control Point Calculation
// http://en.wikipedia.org/wiki/Bézier_curve#Quadratic_B.C3.A9zier_curves
// `t` is the percentage of curve where `third` resides, and should be in [0, 1]
CGPoint GetControlPointForQuadBezier(CGPoint start, CGPoint end, CGPoint third, CGFloat t) {
CGPoint ctrl = CGPointZero;
CGFloat t2 = pow(t, 2);
ctrl.x = -(((pow((1 - t), 2) * start.x) + (t2 * end.x) - third.x) / (2 * t * (1 - t)));
ctrl.y = -(((pow((1 - t), 2) * start.y) + (t2 * end.y) - third.y) / (2 * t * (1 - t)));
return ctrl;
}
@caughtinflux
caughtinflux / atomic_block
Created November 16, 2014 05:59
Simple macro that I use with OSSpinLocks and blocks
LOCKED_EXEC(_lock, _block) OSSpinLockLock(&_lock); _block(); OSSpinLockUnlock(&_lock);
@caughtinflux
caughtinflux / gist:4522600
Created January 13, 2013 06:06
CFMessagePort
_localMessagePort = CFMessagePortCreateLocal(kCFAllocatorDefault, CFSTR(kLocalMessagePortName), callbackHandler, NULL, false);
CFMessagePortSetDispatchQueue(_localMessagePort, _callbackQueue);
CFRunLoopSourceRef localRunLoopSource = CFMessagePortCreateRunLoopSource(kCFAllocatorDefault, _localMessagePort, 0); // this function is returning NULL
CFRunLoopAddSource(CFRunLoopGetCurrent(), localRunLoopSource, kCFRunLoopCommonModes);
CFRelease(localRunLoopSource);